Browse Source

multipart: Resolve immediately if no files are selected

Renée Kooi 7 years ago
parent
commit
38c91c9296
1 changed files with 5 additions and 5 deletions
  1. 5 5
      src/plugins/Multipart.js

+ 5 - 5
src/plugins/Multipart.js

@@ -145,11 +145,6 @@ module.exports = class Multipart extends Plugin {
   }
 
   selectForUpload (files) {
-    if (Object.keys(files).length === 0) {
-      this.core.log('no files to upload!')
-      return
-    }
-
     files.forEach((file, i) => {
       const current = parseInt(i, 10) + 1
       const total = files.length
@@ -171,6 +166,11 @@ module.exports = class Multipart extends Plugin {
   }
 
   handleUpload (fileIDs) {
+    if (fileIDs.length === 0) {
+      this.core.log('Multipart: no files to upload!')
+      return Promise.resolve()
+    }
+
     this.core.log('Multipart is uploading...')
     const files = fileIDs.map(getFile, this)
     function getFile (fileID) {