Repository navigation
fix(storage): validate blob names in Blob initialization and path_helper - #19264
Open
nidhiii-27 wants to merge 1 commit into
Open
nidhiii-27 wants to merge 1 commit into
nidhiii-27 wants to merge 1 commit into
Conversation
Blob.__init__ and Blob.path_helper now validate object names via _validate_blob_name and raise ValueError for "." and ".." (in both str and bytes forms), matching the client-side name validation pattern used by Bucket. Valid object names containing dots or slashes (such as ".hidden", "..foo", "foo.txt", "a/./b", and "a/../b") as well as empty names at construction remain unchanged. Added unit tests for Blob.__init__ and Blob.path_helper in tests/unit/test_blob.py. [Generated-by: AI]
Contributor
Author
|
/gcbrun |
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces validation for blob names in the Google Cloud Storage Python client, preventing the use of "." or ".." (and their bytes equivalents) as blob names. It updates the Blob constructor and path_helper method to raise a ValueError when these invalid names are provided, and updates the corresponding docstrings. Additionally, unit tests have been added to verify that invalid names are correctly rejected while valid names containing dots are still accepted. I have no feedback to provide as the implementation is clean and well-tested.
nidhiii-27
marked this pull request as ready for review
November 29, 2026 16:56
nidhiii-27
requested review from
chandra-siri
and removed request for
a team
November 29, 2026 16:56
This branch has not been deployed
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.
Blob.init and Blob.path_helper now validate object names via _validate_blob_name and raise ValueError for "." and ".." (in both str and bytes forms), matching the client-side name validation pattern used by Bucket. Valid object names containing dots or slashes (such as ".hidden", "..foo", "foo.txt", "a/./b", and "a/../b") as well as empty names at construction remain unchanged. Added unit tests for Blob.init and Blob.path_helper in tests/unit/test_blob.py.