From 0e3bfab5336c771d08d3b69eaf3d026f3b2222de Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 26 Oct 2015 11:16:18 -0700 Subject: [PATCH] Make Swift backend respect Content-Type in create/store Change-Id: I479d1fc4f261bdcdc380404db0cb2f2397877759 --- includes/filebackend/SwiftFileBackend.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/filebackend/SwiftFileBackend.php b/includes/filebackend/SwiftFileBackend.php index e72d026205..83c1da190d 100644 --- a/includes/filebackend/SwiftFileBackend.php +++ b/includes/filebackend/SwiftFileBackend.php @@ -262,7 +262,9 @@ class SwiftFileBackend extends FileBackendStore { } $sha1Hash = wfBaseConvert( sha1( $params['content'] ), 16, 36, 31 ); - $contentType = $this->getContentType( $params['dst'], $params['content'], null ); + $contentType = isset( $params['headers']['content-type'] ) + ? $params['headers']['content-type'] + : $this->getContentType( $params['dst'], $params['content'], null ); $reqs = array( array( 'method' => 'PUT', @@ -318,7 +320,9 @@ class SwiftFileBackend extends FileBackendStore { return $status; } $sha1Hash = wfBaseConvert( $sha1Hash, 16, 36, 31 ); - $contentType = $this->getContentType( $params['dst'], null, $params['src'] ); + $contentType = isset( $params['headers']['content-type'] ) + ? $params['headers']['content-type'] + : $this->getContentType( $params['dst'], null, $params['src'] ); $handle = fopen( $params['src'], 'rb' ); if ( $handle === false ) { // source doesn't exist? -- 2.20.1