Index: trunk/phase3/includes/filerepo/File.php |
— | — | @@ -1001,9 +1001,13 @@ |
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | /** |
1005 | | - * Get an associative array containing information about a file in the local filesystem |
| 1005 | + * Get an associative array containing information about a file in the local filesystem\ |
| 1006 | + * |
| 1007 | + * @param string $path Absolute local filesystem path |
| 1008 | + * @param mixed $ext The file extension, or true to extract it from the filename. |
| 1009 | + * Set it to false to ignore the extension. |
1006 | 1010 | */ |
1007 | | - static function getPropsFromPath( $path ) { |
| 1011 | + static function getPropsFromPath( $path, $ext = true ) { |
1008 | 1012 | wfProfileIn( __METHOD__ ); |
1009 | 1013 | wfDebug( __METHOD__.": Getting file info for $path\n" ); |
1010 | 1014 | $info = array( 'fileExists' => file_exists( $path ) ); |
— | — | @@ -1011,7 +1015,7 @@ |
1012 | 1016 | if ( $info['fileExists'] ) { |
1013 | 1017 | $magic = MimeMagic::singleton(); |
1014 | 1018 | |
1015 | | - $info['mime'] = $magic->guessMimeType( $path, true ); |
| 1019 | + $info['mime'] = $magic->guessMimeType( $path, $ext ); |
1016 | 1020 | list( $info['major_mime'], $info['minor_mime'] ) = self::splitMime( $info['mime'] ); |
1017 | 1021 | $info['media_type'] = $magic->getMediaType( $path, $info['mime'] ); |
1018 | 1022 | |
Index: trunk/phase3/includes/SpecialUpload.php |
— | — | @@ -108,7 +108,6 @@ |
109 | 109 | $this->mFileSize = $request->getFileSize( 'wpUploadFile' ); |
110 | 110 | $this->mSrcName = $request->getFileName( 'wpUploadFile' ); |
111 | 111 | $this->mCurlError = $request->getUploadError( 'wpUploadFile' ); |
112 | | - $this->mFileProps = File::getPropsFromPath( $this->mTempPath ); |
113 | 112 | $this->mSessionKey = false; |
114 | 113 | $this->mStashed = false; |
115 | 114 | $this->mRemoveTempFile = false; // PHP will handle this |
— | — | @@ -360,6 +359,7 @@ |
361 | 360 | * probably not accept it. |
362 | 361 | */ |
363 | 362 | if( !$this->mStashed ) { |
| 363 | + $this->mFileProps = File::getPropsFromPath( $this->mTempPath, $finalExt ); |
364 | 364 | $this->checkMacBinary(); |
365 | 365 | $veri = $this->verify( $this->mTempPath, $finalExt ); |
366 | 366 | |