Skip to content
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

Signed URL: Special Chars in file name not handled properly in V4 version #7835

Closed
chvreddy opened this issue Sep 24, 2020 · 5 comments · Fixed by #7860
Closed

Signed URL: Special Chars in file name not handled properly in V4 version #7835

chvreddy opened this issue Sep 24, 2020 · 5 comments · Fixed by #7860
Assignees
Labels
api: storage Issues related to the Cloud Storage API. type: question Request for information or clarification. Not an issue.

Comments

@chvreddy
Copy link

Thanks for stopping by to let us know something could be better!

Environment details

  • OS: MAC
  • Ruby version: ruby 2.4.9p362 (2019-10-02 revision 67824) [x86_64-darwin19]
  • Gem name and version: gem 'google-cloud-storage', '1.27.0'

Steps to reproduce

  1. ...

Code example

gcs_object.signed_url( method: "GET", expires: 5 * 60, issuer: issuer, signer: signer, version: :v4 )

<Error>
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>
<Details>No such object: bucket_name/folder1/id,+firstn,+lastn/image1.jpeg</Details>
</Error>

With V4 unable to convert special char + to '%20 hence getting above error.

Code example

gcs_object.signed_url( method: "GET", expires: 5 * 60, issuer: issuer, signer: signer, version: :v2 )

When using version V2, Able to download the image.

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

@quartzmo quartzmo self-assigned this Sep 24, 2020
@quartzmo quartzmo added api: storage Issues related to the Cloud Storage API. type: question Request for information or clarification. Not an issue. labels Sep 24, 2020
@quartzmo
Copy link
Member

Can you try upgrading to version 1.29.0? It includes this fix provided by @cfactolerin.

@chvreddy
Copy link
Author

upgraded to gem 'google-cloud-storage', '1.29.0'
Still same issue

@cfactolerin
Copy link
Contributor

Hi @quartzmo I think my fix did not include this unfortunately. What i fixed was only the query params when we wanted to have a different file name during downloading of the file. I saw another CGI.escape here.

This however might involve business decisions already because this means that before signer v4, cloud storage is allowing spaces on the file names. Now, the file path actually includes + instead.

@quartzmo
Copy link
Member

@chvreddy Thank you for reporting this bug. It looks like the path in v4 should use %20 for spaces, so I expect I will be able to publish a fix. I'm currently requesting an update to the shared conformance tests for this feature in order to specify the behavior in those tests.

@chvreddy
Copy link
Author

Thanks @quartzmo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. type: question Request for information or clarification. Not an issue.
Projects
None yet
3 participants