Bartosz Dziewoński has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/278547

Change subject: UploadBase: Set mFileSize, if given, even if mTempPath is 
unknown
......................................................................

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
---
M includes/upload/UploadBase.php
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/47/278547/1

diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php
index fb25249..9d7b294 100644
--- a/includes/upload/UploadBase.php
+++ b/includes/upload/UploadBase.php
@@ -241,12 +241,14 @@
         */
        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;
                }
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/278547
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie35a66a565a370fe9adc66d5fee0866c4d51470e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to