Always validate uploads over api
[lhc/web/wiklou.git] / includes / api / ApiUpload.php
index 12ecd74..f0d271c 100644 (file)
@@ -74,20 +74,8 @@ class ApiUpload extends ApiBase {
                }
 
                // Check if the uploaded file is sane
-               if ( $this->mParams['chunk'] ) {
-                       $maxSize = UploadBase::getMaxUploadSize();
-                       if ( $this->mParams['filesize'] > $maxSize ) {
-                               $this->dieWithError( 'file-too-large' );
-                       }
-                       if ( !$this->mUpload->getTitle() ) {
-                               $this->dieWithError( 'illegal-filename' );
-                       }
-               } elseif ( $this->mParams['async'] && $this->mParams['filekey'] ) {
-                       // defer verification to background process
-               } else {
-                       wfDebug( __METHOD__ . " about to verify\n" );
-                       $this->verifyUpload();
-               }
+               wfDebug( __METHOD__ . " about to verify\n" );
+               $this->verifyUpload();
 
                // Check if the user has the rights to modify or overwrite the requested title
                // (This check is irrelevant if stashing is already requested, since the errors
@@ -417,7 +405,7 @@ class ApiUpload extends ApiBase {
                if ( $this->mParams['filekey'] && $this->mParams['checkstatus'] ) {
                        $progress = UploadBase::getSessionStatus( $this->getUser(), $this->mParams['filekey'] );
                        if ( !$progress ) {
-                               $this->dieWithError( 'api-upload-missingresult', 'missingresult' );
+                               $this->dieWithError( 'apierror-upload-missingresult', 'missingresult' );
                        } elseif ( !$progress['status']->isGood() ) {
                                $this->dieStatusWithCode( $progress['status'], 'stashfailed' );
                        }