Skip to content

Conversation

eullerborges
Copy link

Fixes #1177. I tried Content-MD5 as well, but that was more involved.

Copy link

@rampageservices rampageservices left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo needs fixing.
Suggest improvement for readability.

sha256_hash = checksum_sha256_file(stream, offset, size_total)
request.body = sha256_hash

# Provide the checksum with teh request. This is important for buckets that have

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"the" is spelled incorrectly here, shown as "teh". Minor typo.


# Provide the checksum with teh request. This is important for buckets that have
# Object Lock enabled.
headers['x-amz-checksum-sha256'] = base64.b64encode(sha256_hash.digest()).decode()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

base64.b64encode(sha256_hash.digest()).decode()
Can this line be broken down? It is doing a lot all at once. It is hard for readability.
Perhaps we canpull out the digest operation into a separate sha256_hash_digest variable?
Or maybe this functionality can be separated into a new function in S3/Crypto.py

I know this exact line is recommended online in tutorials but is in my opinion hard to read.
See: https://debugpointer.com/python/sha256-to-base64-python

@snosratiershad
Copy link
Contributor

I think we can close this PR as #1393 has completed this reviews.

@fviard
Copy link
Contributor

fviard commented Jan 27, 2025

Closing as suggested, to be replaced by #1393

@fviard fviard closed this Jan 27, 2025
@eullerborges
Copy link
Author

Sorry for not coming back to this, I've been away from GitHub for a while. I'm glad this was picked up and merged in. Thank you!

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.

Missing Content-MD5 http header for put request on object with bucket defined Lock

4 participants