Fixed file props test failure for MemoryFileBackend
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 9 Jan 2014 19:04:20 +0000 (11:04 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 9 Jan 2014 19:04:20 +0000 (11:04 -0800)
Change-Id: Ia593023569e3874e11598c38961a68a0da75883f

includes/filebackend/MemoryFileBackend.php

index 3924c12..6f40957 100644 (file)
@@ -155,7 +155,9 @@ class MemoryFileBackend extends FileBackendStore {
                        if ( $src === null || !isset( $this->files[$src] ) ) {
                                $fsFile = null;
                        } else {
-                               $fsFile = TempFSFile::factory( 'localcopy_' );
+                               // Create a new temporary file with the same extension...
+                               $ext = FileBackend::extensionFromPath( $src );
+                               $fsFile = TempFSFile::factory( 'localcopy_', $ext );
                                if ( $fsFile ) {
                                        $bytes = file_put_contents( $fsFile->getPath(), $this->files[$src]['data'] );
                                        if ( $bytes !== strlen( $this->files[$src]['data'] ) ) {