|
@@ -600,6 +600,14 @@ class Uploader {
|
|
|
const filename = this.uploadFileName
|
|
|
const { client, options } = this.options.s3
|
|
|
|
|
|
+ function getPartSize (chunkSize) {
|
|
|
+ // backwards compatibility https://github.com/transloadit/uppy/pull/3511#issuecomment-1050797935
|
|
|
+ // requires min 5MiB and max 5GiB partSize
|
|
|
+ // todo remove this logic in the next major semver
|
|
|
+ if (chunkSize == null || chunkSize >= 5368709120 || chunkSize <= 5242880) return undefined
|
|
|
+ return chunkSize
|
|
|
+ }
|
|
|
+
|
|
|
const upload = client.upload({
|
|
|
Bucket: options.bucket,
|
|
|
Key: options.getKey(null, filename, this.options.metadata),
|
|
@@ -607,6 +615,8 @@ class Uploader {
|
|
|
ContentType: this.options.metadata.type,
|
|
|
Metadata: this.options.metadata,
|
|
|
Body: stream,
|
|
|
+ }, {
|
|
|
+ partSize: getPartSize(this.options.chunkSize),
|
|
|
})
|
|
|
|
|
|
upload.on('httpUploadProgress', ({ loaded, total }) => {
|