Merge "REST API initial commit"
[lhc/web/wiklou.git] / includes / api / ApiUpload.php
index f0d271c..fc41e4e 100644 (file)
@@ -74,8 +74,20 @@ class ApiUpload extends ApiBase {
                }
 
                // Check if the uploaded file is sane
-               wfDebug( __METHOD__ . " about to verify\n" );
-               $this->verifyUpload();
+               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();
+               }
 
                // 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