There is an issue where if you specify a checksum but not the checksum algorithm the functions ChecksumAlgorithmHasBeenSet and GetChecksumAlgorithmName would not return the expected value. This issue especially shows its head when you are using s3express and do something like
const auto client = Aws::MakeUnique<S3Client>("test");
auto request = PutObjectRequest().WithBucket(BUCKET_NAME)
.WithKey("test-key")
.WithChecksumSHA256(HashingUtils::Base64Encode(HashingUtils::CalculateSHA256("somebody")));
std::shared_ptr<IOStream> body = Aws::MakeShared<StringStream>("Test",
"somebody",
std::ios_base::in | std::ios_base::binary);
request.SetBody(body);
const auto response = client->PutObject(request);
we use the logic in ChecksumAlgorithmHasBeenSet and GetChecksumAlgorithmName to determine if we need to default to crc32 as s3express does not support md5.
This changes to call SetChecksumAlgorithm when setting a checksum so that the implicit requirement of setting the checksum algorithm is no longer required.
Check all that applies:
[x] Did a review by yourself.
[x] Added proper tests to cover this PR. (If tests are not applicable, explain.)
[x] Checked if this PR is a breaking (APIs have been changed) change.
[x] Checked if this PR will not introduce cross-platform inconsistent behavior.
[x] Checked if this PR would require a ReadMe/Wiki update.
Check which platforms you have built SDK on to verify the correctness of this PR.
[x] Linux
[x] Windows
[ ] Android
[x] MacOS
[ ] IOS
[ ] Other Platforms
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Description of changes:
There is an issue where if you specify a checksum but not the checksum algorithm the functions
ChecksumAlgorithmHasBeenSet
andGetChecksumAlgorithmName
would not return the expected value. This issue especially shows its head when you are using s3express and do something likewe use the logic in
ChecksumAlgorithmHasBeenSet
andGetChecksumAlgorithmName
to determine if we need to default to crc32 as s3express does not support md5.This changes to call
SetChecksumAlgorithm
when setting a checksum so that the implicit requirement of setting the checksum algorithm is no longer required.Check all that applies:
Check which platforms you have built SDK on to verify the correctness of this PR.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.