Enable streaming upload in S3 : put_object#658
Open
oconnore wants to merge 2 commits into
Open
Conversation
There were two problems:
1) Request did not allow an IO
2) Signing did not permit an unsigned payload
(https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html)
oconnore
force-pushed
the
streaming-upload
branch
from
September 19, 2023 05:25
cccbf1e to
08b9a04
Compare
ararslan
reviewed
Jun 12, 2024
ararslan
left a comment
Member
There was a problem hiding this comment.
Apologies for the long silence here. Could you add some tests to ensure this works as intended?
Comment on lines
+67
to
+72
| if !haskey(request.headers, "x-amz-content-sha256") | ||
| content_hash = bytes2hex(digest(MD_SHA256, request.content)) | ||
| request.headers["x-amz-content-sha256"] = content_hash | ||
| else | ||
| content_hash = "UNSIGNED-PAYLOAD" | ||
| end |
Member
There was a problem hiding this comment.
You can write this a bit more concisely like so:
Suggested change
| if !haskey(request.headers, "x-amz-content-sha256") | |
| content_hash = bytes2hex(digest(MD_SHA256, request.content)) | |
| request.headers["x-amz-content-sha256"] = content_hash | |
| else | |
| content_hash = "UNSIGNED-PAYLOAD" | |
| end | |
| content_hash = get!(request.headers, "x-amz-content-sha256") do | |
| bytes2hex(digest(MD_SHA256, request.content)) | |
| end |
| request.headers["x-amz-content-sha256"] = "UNSIGNED-PAYLOAD" | ||
| else | ||
| request.headers["Content-MD5"] = base64encode( | ||
| digest(MD_MD5, request.content)) |
Member
There was a problem hiding this comment.
This repository uses the Blue style guide, which puts closing parentheses on the following line in cases like this
Suggested change
| digest(MD_MD5, request.content)) | |
| digest(MD_MD5, request.content) | |
| ) |
Supposedly automatic formatting suggestions are set up but that appears to not have occurred here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There were two problems:
(https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html)