Fix object storage multipart upload
This commit is contained in:
parent
8a7abfef88
commit
1c93ad0778
|
@ -29,6 +29,20 @@ function getClient () {
|
||||||
: undefined
|
: undefined
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// FIXME: https://github.com/aws/aws-sdk-js-v3/issues/2445 workaround
|
||||||
|
s3Client.middlewareStack.add(
|
||||||
|
(next, _context) => (args: any) => {
|
||||||
|
if (typeof args.request?.body === 'string' && args.request.body.includes('CompletedMultipartUpload')) {
|
||||||
|
args.request.body = args.request.body.replace(/CompletedMultipartUpload/g, 'CompleteMultipartUpload')
|
||||||
|
}
|
||||||
|
return next(args)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
step: 'build',
|
||||||
|
priority: 'high'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
logger.info('Initialized S3 client %s with region %s.', getEndpoint(), OBJECT_STORAGE.REGION, lTags())
|
logger.info('Initialized S3 client %s with region %s.', getEndpoint(), OBJECT_STORAGE.REGION, lTags())
|
||||||
|
|
||||||
return s3Client
|
return s3Client
|
||||||
|
|
|
@ -216,7 +216,7 @@ async function multiPartUpload (options: {
|
||||||
|
|
||||||
const completeUploadCommand = new CompleteMultipartUploadCommand({
|
const completeUploadCommand = new CompleteMultipartUploadCommand({
|
||||||
Bucket: bucketInfo.BUCKET_NAME,
|
Bucket: bucketInfo.BUCKET_NAME,
|
||||||
Key: objectStorageKey,
|
Key: key,
|
||||||
UploadId: createResponse.UploadId,
|
UploadId: createResponse.UploadId,
|
||||||
MultipartUpload: { Parts: parts }
|
MultipartUpload: { Parts: parts }
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue