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
fix(storage): fix upload object with bucket cmek enabled #158
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8d0fe99
fix(storage): fix upload object with bucket cmek enabled
HemangChothani 0b254c0
Merge branch 'master' into storage_issue_155
frankyn 14a31db
Merge branch 'master' into storage_issue_155
frankyn ba92f58
fix(storage): add comments for condition used
HemangChothani 71935ad
fix(storage): nit
HemangChothani File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1280,7 +1280,14 @@ def _do_multipart_upload( | |
if self.user_project is not None: | ||
name_value_pairs.append(("userProject", self.user_project)) | ||
|
||
if self.kms_key_name is not None: | ||
# When cmek is enabled for bucket blob.metadata stores the value of | ||
# kmsKeyName with version information whereas upload method expect | ||
# information without version so this condition ignores the kmsKeyName | ||
# which has cryptoKeyVersions. | ||
if ( | ||
self.kms_key_name is not None | ||
and "cryptoKeyVersions" not in self.kms_key_name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add comments on why this is needed for posterity. Mainly that Cloud Storage object metadata stores kmsKeyName with version information and uploads() expect non-versioned information. |
||
): | ||
name_value_pairs.append(("kmsKeyName", self.kms_key_name)) | ||
|
||
if predefined_acl is not None: | ||
|
@@ -1417,7 +1424,14 @@ def _initiate_resumable_upload( | |
if self.user_project is not None: | ||
name_value_pairs.append(("userProject", self.user_project)) | ||
|
||
if self.kms_key_name is not None: | ||
# When cmek is enabled for bucket blob.metadata stores the value of | ||
# kmsKeyName with version information whereas upload method expect | ||
# information without version so this condition ignores the kmsKeyName | ||
# which has cryptoKeyVersions. | ||
if ( | ||
self.kms_key_name is not None | ||
and "cryptoKeyVersions" not in self.kms_key_name | ||
): | ||
name_value_pairs.append(("kmsKeyName", self.kms_key_name)) | ||
|
||
if predefined_acl is not None: | ||
|
This file contains 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
This file contains 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
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 was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested changes: