Google-cloud-ruby: Signed URL: Special Chars in file name not handled properly in V4 version

Created on 24 Sep 2020  路  5Comments  路  Source: googleapis/google-cloud-ruby

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!

storage question

All 5 comments

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

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

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.

@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.

Thanks @quartzmo

Was this page helpful?
0 / 5 - 0 ratings