Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not require checksum algorithm when checksum is set #2871

Merged
merged 1 commit into from
Feb 23, 2024
Merged

Conversation

sbiscigl
Copy link
Contributor

Description of changes:

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:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • 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.

  • Linux
  • Windows
  • Android
  • 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.

@sbiscigl sbiscigl force-pushed the checksum-ux branch 2 times, most recently from 18a4455 to 913c9da Compare February 23, 2024 20:25
@sbiscigl sbiscigl marked this pull request as ready for review February 23, 2024 22:06
@sbiscigl sbiscigl merged commit 60f3e40 into main Feb 23, 2024
4 checks passed
@sbiscigl sbiscigl deleted the checksum-ux branch February 23, 2024 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants