r23056 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23055‎ | r23056 | r23057 >
Date:06:35, 18 June 2007
Author:tstarling
Status:old
Tags:
Comment:
Fixed regression in file type detection -- use the real file extension not the temporary file extension
Modified paths:
  • /trunk/phase3/includes/SpecialUpload.php (modified) (history)
  • /trunk/phase3/includes/filerepo/File.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/File.php
@@ -1001,9 +1001,13 @@
10021002 }
10031003
10041004 /**
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.
10061010 */
1007 - static function getPropsFromPath( $path ) {
 1011+ static function getPropsFromPath( $path, $ext = true ) {
10081012 wfProfileIn( __METHOD__ );
10091013 wfDebug( __METHOD__.": Getting file info for $path\n" );
10101014 $info = array( 'fileExists' => file_exists( $path ) );
@@ -1011,7 +1015,7 @@
10121016 if ( $info['fileExists'] ) {
10131017 $magic = MimeMagic::singleton();
10141018
1015 - $info['mime'] = $magic->guessMimeType( $path, true );
 1019+ $info['mime'] = $magic->guessMimeType( $path, $ext );
10161020 list( $info['major_mime'], $info['minor_mime'] ) = self::splitMime( $info['mime'] );
10171021 $info['media_type'] = $magic->getMediaType( $path, $info['mime'] );
10181022
Index: trunk/phase3/includes/SpecialUpload.php
@@ -108,7 +108,6 @@
109109 $this->mFileSize = $request->getFileSize( 'wpUploadFile' );
110110 $this->mSrcName = $request->getFileName( 'wpUploadFile' );
111111 $this->mCurlError = $request->getUploadError( 'wpUploadFile' );
112 - $this->mFileProps = File::getPropsFromPath( $this->mTempPath );
113112 $this->mSessionKey = false;
114113 $this->mStashed = false;
115114 $this->mRemoveTempFile = false; // PHP will handle this
@@ -360,6 +359,7 @@
361360 * probably not accept it.
362361 */
363362 if( !$this->mStashed ) {
 363+ $this->mFileProps = File::getPropsFromPath( $this->mTempPath, $finalExt );
364364 $this->checkMacBinary();
365365 $veri = $this->verify( $this->mTempPath, $finalExt );
366366

Follow-up revisions

RevisionCommit summaryAuthorDate
r23087Merged revisions 23050-23086 via svnmerge from...david03:14, 19 June 2007

Status & tagging log