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

S3 PutObject with ChecksumAlgorithm Sets Empty Content-Encoding Header #3568

Closed
giacomorebecchi opened this issue Jan 26, 2023 · 2 comments
Closed
Labels
bug This issue is a confirmed bug. closing-soon This issue will automatically close in 4 days unless further comments are made. p2 This is a standard priority issue s3

Comments

@giacomorebecchi
Copy link

Describe the bug

When calling the method put_object in the S3 client, if the request has a ChecksumAlgorithm specified, the ContentEncoding argument gets overwritten and set to an empty string.

Expected Behavior

I expect my manually-set ContentEncoding argument to be preserved.

Current Behavior

Currently the ContentEncoding gets overwritten and set to an empty string.

Reproduction Steps

import boto3
import gzip

client = boto3.client("s3")
client.put_object(
    Body=gzip.compress(b"test-object"),
    Key="test/key",
    Bucket="test",
    ContentEncoding="gzip",  # I want this to be set to gzip
    ChecksumAlgorithm="SHA1",
)

client.head_object(
    Key="test/key",
    Bucket="test",
    ChecksumMode="ENABLED",
)

produces as output:

{'ResponseMetadata': {'RequestId': '...', 'HostId': '...', 'HTTPStatusCode': 200, 'HTTPHeaders': {'x-amz-id-2': '...', 'x-amz-request-id': '...', 'date': 'Thu, 26 Jan 2023 09:25:14 GMT', 'last-modified': 'Thu, 26 Jan 2023 09:25:13 GMT', 'etag': '"..."', 'x-amz-checksum-sha1': '/CTXfXUwTM/KvoFXC7OEpF7/dIA=', 'x-amz-server-side-encryption': 'AES256', 'content-encoding': '', 'accept-ranges': 'bytes', 'content-type': 'binary/octet-stream', 'server': 'AmazonS3', 'content-length': '25'}, 'RetryAttempts': 0}, 'AcceptRanges': 'bytes', 'LastModified': datetime.datetime(2023, 1, 26, 9, 25, 13, tzinfo=tzutc()), 'ContentLength': 25, 'ChecksumSHA1': '/CTXfXUwTM/KvoFXC7OEpF7/dIA=', 'ETag': '"75e79ae360a5e94d1c74a7ce1c80599c"', 'ContentEncoding': '', 'ContentType': 'binary/octet-stream', 'ServerSideEncryption': 'AES256', 'Metadata': {}}

Possible Solution

The same issue is being discussed in the Java SDK:

Additional Information/Context

No response

SDK version used

1.26.57

Environment details (OS name and version, etc.)

Linux - Ubuntu

@giacomorebecchi giacomorebecchi added bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Jan 26, 2023
@tim-finnigan
Copy link
Contributor

Thanks @giacomorebecchi for reaching out. I could reproduce the issue as you described. I'll mark this issue for further review by the team.

@tim-finnigan tim-finnigan added needs-review p2 This is a standard priority issue s3 and removed needs-triage This issue or PR still needs to be triaged. labels Jan 27, 2023
@nateprewitt
Copy link
Contributor

Now that boto/botocore#2859 is merged, this should be resolved in today's release (boto3 1.26.62). We'll put this ticket on track to resolve in the next few days, but please let us know if you're still experiencing any issues with the latest release. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a confirmed bug. closing-soon This issue will automatically close in 4 days unless further comments are made. p2 This is a standard priority issue s3
Projects
None yet
Development

No branches or pull requests

3 participants