File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import {
1010 S3Client ,
1111 S3ClientConfig ,
1212 UploadPartCommand ,
13+ UploadPartCommandInput ,
1314 waitUntilBucketExists
1415} from '@aws-sdk/client-s3' ;
1516import { AbortController } from '@aws-sdk/abort-controller' ;
@@ -212,17 +213,18 @@ export class S3Storage extends BaseStorage<S3File> {
212213 if ( this . isUnsupportedChecksum ( part . checksumAlgorithm ) ) {
213214 return fail ( ERRORS . UNSUPPORTED_CHECKSUM_ALGORITHM ) ;
214215 }
215- const checksumMD5 = part . checksumAlgorithm === 'md5' ? part . checksum : '' ;
216216 const partNumber = file . Parts . length + 1 ;
217- const params = {
217+ const params : UploadPartCommandInput = {
218218 Bucket : this . bucket ,
219219 Key : file . name ,
220220 UploadId : file . UploadId ,
221221 PartNumber : partNumber ,
222222 Body : part . body ,
223- ContentLength : part . contentLength || 0 ,
224- ContentMD5 : checksumMD5
223+ ContentLength : part . contentLength || 0
225224 } ;
225+ if ( part . checksumAlgorithm === 'md5' ) {
226+ params . ContentMD5 = part . checksum ;
227+ }
226228 const abortSignal = new AbortController ( ) . signal ;
227229 part . body . on ( 'error' , _err => abortSignal . abort ( ) ) ;
228230 const { ETag } = await this . client . send ( new UploadPartCommand ( params ) , { abortSignal } ) ;
You can’t perform that action at this time.
0 commit comments