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
*/
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;
}
}