Browse Source

Transloadit: Fix starting uploads while previously uploaded files are still in state (#186)

Renée Kooi 8 years ago
parent
commit
b98973bf8b
1 changed files with 9 additions and 1 deletions
  1. 9 1
      src/plugins/Transloadit/index.js

+ 9 - 1
src/plugins/Transloadit/index.js

@@ -52,10 +52,18 @@ module.exports = class Transloadit extends Plugin {
   createAssembly () {
     this.core.log('Transloadit: create assembly')
 
+    const files = this.core.state.files
+    const expectedFiles = Object.keys(files).reduce((count, fileID) => {
+      if (!files[fileID].progress.uploadStarted || files[fileID].isRemote) {
+        return count + 1
+      }
+      return count
+    }, 0)
+
     return this.client.createAssembly({
       params: this.opts.params,
       fields: this.opts.fields,
-      expectedFiles: Object.keys(this.core.state.files).length,
+      expectedFiles,
       signature: this.opts.signature
     }).then((assembly) => {
       this.updateState({ assembly })