Skip to content

Commit 67006b8

Browse files
committed
fix(lib-storage): set ChecksumAlgorithm based on requestChecksumCalculation
1 parent 4afe35d commit 67006b8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/lib-storage/src/Upload.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,11 @@ export class Upload extends EventEmitter {
201201

202202
private async __createMultipartUpload(): Promise<CreateMultipartUploadCommandOutput> {
203203
if (!this.createMultiPartPromise) {
204-
const createCommandParams = {
205-
ChecksumAlgorithm: ChecksumAlgorithm.CRC32,
206-
...this.params,
207-
Body: undefined,
208-
};
204+
const createCommandParams = { ...this.params, Body: undefined };
205+
const requestChecksumCalculation = await this.client.config.requestChecksumCalculation();
206+
if (requestChecksumCalculation === "WHEN_SUPPORTED") {
207+
createCommandParams.ChecksumAlgorithm = ChecksumAlgorithm.CRC32;
208+
}
209209
this.createMultiPartPromise = this.client
210210
.send(new CreateMultipartUploadCommand(createCommandParams))
211211
.then((createMpuResponse) => {

0 commit comments

Comments
 (0)