From: Aaron Date: Tue, 31 Jul 2012 17:53:27 +0000 (-0700) Subject: [FileBackend] Made swift handle unknown content types better. X-Git-Tag: 1.31.0-rc.0~22902^2 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=57f8d0ec93dc6b5bb72188830067ccfc2f52f6bb;p=lhc%2Fweb%2Fwiklou.git [FileBackend] Made swift handle unknown content types better. Change-Id: I50a5c17c40152a9e469a54bdd70a8408c57ebd50 --- diff --git a/includes/filerepo/backend/SwiftFileBackend.php b/includes/filerepo/backend/SwiftFileBackend.php index 5f82a90ef9..30634409c3 100644 --- a/includes/filerepo/backend/SwiftFileBackend.php +++ b/includes/filerepo/backend/SwiftFileBackend.php @@ -188,6 +188,9 @@ class SwiftFileBackend extends FileBackendStore { $obj->set_etag( md5( $params['content'] ) ); // Use the same content type as StreamFile for security $obj->content_type = StreamFile::contentTypeFromPath( $params['dst'] ); + if ( !strlen( $obj->content_type ) ) { // special case + $obj->content_type = 'unknown/unknown'; + } if ( !empty( $params['async'] ) ) { // deferred $handle = $obj->write_async( $params['content'] ); $status->value = new SwiftFileOpHandle( $this, $params, 'Create', $handle ); @@ -267,6 +270,9 @@ class SwiftFileBackend extends FileBackendStore { $obj->set_etag( md5_file( $params['src'] ) ); // Use the same content type as StreamFile for security $obj->content_type = StreamFile::contentTypeFromPath( $params['dst'] ); + if ( !strlen( $obj->content_type ) ) { // special case + $obj->content_type = 'unknown/unknown'; + } if ( !empty( $params['async'] ) ) { // deferred wfSuppressWarnings(); $fp = fopen( $params['src'], 'rb' );