From: Bartosz DziewoƄski Date: Sun, 20 Mar 2016 07:24:29 +0000 (+0100) Subject: UploadBase: Set mFileSize, if given, even if mTempPath is unknown X-Git-Tag: 1.31.0-rc.0~7557 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=93d65f2968b76c9b7685ee2c44c5297a7a2a78a2;p=lhc%2Fweb%2Fwiklou.git UploadBase: Set mFileSize, if given, even if mTempPath is unknown When uploading a file from stash using the action=upload API, with async=1, UploadFromStash is initialized without initializing a temp file. dcb5ec5cbf92b9a07f0776b9c194183a13400193 accidentally made it so that the given file size is ignored if there's no path. This caused validity checks to fail (because mFileSize is null) and action=upload to also fail with cryptic 'emptyfile' warning. This made it impossible to upload files bigger than 10 MB using UploadWizard, as it uses the async mode for them. Bug: T130238 Change-Id: Ie35a66a565a370fe9adc66d5fee0866c4d51470e --- diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index fb25249bd3..9d7b294e24 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -241,12 +241,14 @@ abstract class UploadBase { */ protected function setTempFile( $tempPath, $fileSize = null ) { $this->mTempPath = $tempPath; + $this->mFileSize = $fileSize ?: null; if ( strlen( $this->mTempPath ) && file_exists( $this->mTempPath ) ) { $this->tempFileObj = new TempFSFile( $this->mTempPath ); - $this->mFileSize = $fileSize ?: filesize( $this->mTempPath ); + if ( !$fileSize ) { + $this->mFileSize = filesize( $this->mTempPath ); + } } else { $this->tempFileObj = null; - $this->mFileSize = null; } }