Selaa lähdekoodia

S3 multipart: Do not store completed parts in state (#2326)

Co-authored-by: Renée Kooi <renee@kooi.me>
Yegor Yarko 4 vuotta sitten
vanhempi
commit
988a7ede30

+ 1 - 1
packages/@uppy/aws-s3-multipart/src/MultipartUploader.js

@@ -34,7 +34,7 @@ class MultipartUploader {
 
 
     this.key = this.options.key || null
     this.key = this.options.key || null
     this.uploadId = this.options.uploadId || null
     this.uploadId = this.options.uploadId || null
-    this.parts = this.options.parts || []
+    this.parts = []
 
 
     // Do `this.createdPromise.then(OP)` to execute an operation `OP` _only_ if the
     // Do `this.createdPromise.then(OP)` to execute an operation `OP` _only_ if the
     // upload was created already. That also ensures that the sequencing is right
     // upload was created already. That also ensures that the sequencing is right

+ 1 - 12
packages/@uppy/aws-s3-multipart/src/index.js

@@ -134,8 +134,7 @@ module.exports = class AwsS3Multipart extends Plugin {
           s3Multipart: {
           s3Multipart: {
             ...cFile.s3Multipart,
             ...cFile.s3Multipart,
             key: data.key,
             key: data.key,
-            uploadId: data.uploadId,
-            parts: []
+            uploadId: data.uploadId
           }
           }
         })
         })
       }
       }
@@ -175,20 +174,10 @@ module.exports = class AwsS3Multipart extends Plugin {
       }
       }
 
 
       const onPartComplete = (part) => {
       const onPartComplete = (part) => {
-        // Store completed parts in state.
         const cFile = this.uppy.getFile(file.id)
         const cFile = this.uppy.getFile(file.id)
         if (!cFile) {
         if (!cFile) {
           return
           return
         }
         }
-        this.uppy.setFileState(file.id, {
-          s3Multipart: {
-            ...cFile.s3Multipart,
-            parts: [
-              ...cFile.s3Multipart.parts,
-              part
-            ]
-          }
-        })
 
 
         this.uppy.emit('s3-multipart:part-uploaded', cFile, part)
         this.uppy.emit('s3-multipart:part-uploaded', cFile, part)
       }
       }