8000 Fix encoding of object names. by houglum · Pull Request #2473 · GoogleCloudPlatform/python-docs-samples · GitHub
[go: up one dir, main page]

Skip to content

Fix encoding of object names. #2473

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

Merged
merged 1 commit into from
Oct 11, 2019

Conversation

houglum
Copy link
Contributor
@houglum houglum commented Oct 11, 2019

Per the docs, the "/" character should not be escaped in the object name
portion of the signed URL. Also, Python 2 and 3 differ on whether the
tilde character should be escaped by the url library's quote method,
so in order for our sample to work on both Python2 and Python3, we
should always specify the tilde as a "safe" character. For reference, we
already fixed this same bug in gsutil a few months ago:
https://github.com/GoogleCloudPlatform/gsutil/blob/4531874e3a3d45ca642fc9c9fa438ba58c8f1494/gslib/commands/signurl.py#L543

Per the docs, the "/" character should not be escaped in the object name
portion of the signed URL.  Also, Python 2 and 3 differ on whether the
tilde character should be escaped by the url library's `quote` method,
so in order for our sample to work on both Python2 and Python3, we
should always specify the tilde as a "safe" character. For reference, we
already fixed this same bug in gsutil a few months ago:
https://github.com/GoogleCloudPlatform/gsutil/blob/4531874e3a3d45ca642fc9c9fa438ba58c8f1494/gslib/commands/signurl.py#L543
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 11, 2019
@houglum
Copy link
Contributor Author
houglum commented Oct 11, 2019

Context: I saw this script included in our docs at https://cloud.google.com/storage/docs/access-control/signing-urls-manually, and was trying to use it to reproduce the issue mentioned in https://issuetracker.google.com/issues/142546499, when I noticed that forward slashes in object names were being encoded. It's mentioned in both our docs and the AWS S3 docs here that you should not escape forward slashes in the object name.

@houglum
Copy link
Contributor Author
houglum commented Oct 11, 2019

Summoning @frankyn for review

Copy link
Contributor
@frankyn frankyn left a comment

Choose a reason for hiding this comment

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

Thanks @houglum!

@frankyn frankyn merged commit 5e0d4cf into GoogleCloudPlatform:master Oct 11, 2019
@frankyn
Copy link
Contributor
frankyn commented Oct 11, 2019

@houglum can you ping TW to republish documentation?

@houglum
Copy link
Contributor Author
houglum commented Oct 11, 2019

Done! CC'd you on the email.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0