Skip to content

Commit 82d8972

Browse files
authored
fix S3 client no longer honor the computeChecksums config (#4052)
1 parent 80bee5c commit 82d8972

File tree

4 files changed

+33
-6
lines changed

4 files changed

+33
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "bugfix",
3+
"category": "S3",
4+
"description": "Fixed a bug that S3 client no longer honor the computeChecksums config introduced in #3799. Previously only the members with httpChecksumRequired trait will be disabled by unseting computeChecksums config. S3 doesn't not honor the config because it has its own logic handling MD5 chechsums."
5+
}

lib/services/s3.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,8 @@ AWS.util.update(AWS.S3.prototype, {
453453
willComputeChecksums: function willComputeChecksums(req) {
454454
var rules = req.service.api.operations[req.operation].input.members;
455455
var body = req.httpRequest.body;
456-
var needsContentMD5 = rules.ContentMD5 &&
456+
var needsContentMD5 = req.service.config.computeChecksums &&
457+
rules.ContentMD5 &&
457458
!req.params.ContentMD5 &&
458459
body &&
459460
(AWS.util.Buffer.isBuffer(req.httpRequest.body) || typeof req.httpRequest.body === 'string');

scripts/region-checker/allowlist.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ var allowlist = {
4141
262,
4242
275,
4343
281,
44-
640,
45-
642,
46-
761,
47-
772,
44+
641,
45+
643,
46+
762,
4847
773,
4948
774,
50-
779
49+
775,
50+
780,
5151
]
5252
};
5353

test/services/s3.spec.js

+21
Original file line numberDiff line numberDiff line change
@@ -2544,6 +2544,27 @@ describe('AWS.S3', function() {
25442544
}
25452545
};
25462546

2547+
it('does not compute checksums if computeChecksums is off', function() {
2548+
willCompute('putObject', {
2549+
computeChecksums: false,
2550+
hash: null
2551+
});
2552+
});
2553+
2554+
it('does not compute checksums if computeChecksums is on and ContentMD5 is provided', function() {
2555+
willCompute('putBucketAcl', {
2556+
computeChecksums: true,
2557+
hash: '000'
2558+
});
2559+
});
2560+
2561+
it('computes checksums if computeChecksums is on and ContentMD5 is not provided', function() {
2562+
willCompute('putBucketAcl', {
2563+
computeChecksums: true,
2564+
hash: '1B2M2Y8AsgTpgAmY7PhCfg=='
2565+
});
2566+
});
2567+
25472568
if (AWS.util.isNode()) {
25482569
it('does not compute checksums for Stream objects', function() {
25492570
s3 = new AWS.S3({

0 commit comments

Comments
 (0)