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

Incorrect encoding of object handle in storage_objects_delete #6510

Closed
youroff opened this issue Oct 11, 2020 · 4 comments
Closed

Incorrect encoding of object handle in storage_objects_delete #6510

youroff opened this issue Oct 11, 2020 · 4 comments
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@youroff
Copy link

youroff commented Oct 11, 2020

It seems to be impossible to delete objects in folders. GCS expects slashes to be encoded, but the following code passes them unchanged, assuming them the valid parts of URI:
https://github.com/googleapis/elixir-google-api/blob/master/clients/storage/lib/google_api/storage/v1/api/objects.ex#L258

iex(3)> URI.encode("dir/file", &(URI.char_unreserved?(&1) || &1 == ?/)) 
"dir/file"
iex(4)> URI.encode("dir%2Ffile", &(URI.char_unreserved?(&1) || &1 == ?/))
"dir%252Ffile"
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Oct 12, 2020
@dacaga
Copy link

dacaga commented Oct 14, 2020

The same goes for storage_objects_get. It's not escaping forward slashes in the object name anymore. Google Cloud Storage's API replies 404s on any object get.

It might have regressed because of #5869.

@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Oct 16, 2020
@dazuma dazuma added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. and removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Oct 16, 2020
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Oct 18, 2020
@dazuma dazuma added priority: p2 Moderately-important priority. Fix may not be included in next release. and removed priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. 🚨 This issue needs some love. labels Oct 19, 2020
@stevencorona
Copy link

Seems like all of the storage calls are busted if they have slashes in the file path. This is a pretty major show stopping issue for me.

jamesvl added a commit to jamesvl/elixir-google-api that referenced this issue Jan 15, 2021
Simple exemption for that parameter, since it appears to be the only one
affected.

Issue googleapis#6352 is probably a duplicate of googleapis#6510.
jamesvl added a commit to jamesvl/elixir-google-api that referenced this issue Jan 15, 2021
Simple exemption for that parameter, since it appears to be the only one
affected.

Issue googleapis#6352 is probably a duplicate of googleapis#6510.
jamesvl added a commit to jamesvl/elixir-google-api that referenced this issue Jan 15, 2021
Simple exemption for that parameter, since it appears to be the only one
affected.

Issue googleapis#6352 is probably a duplicate of googleapis#6510.
jamesvl added a commit to jamesvl/elixir-google-api that referenced this issue Jan 16, 2021
Simple exemption for that parameter, since it appears to be the only one
affected.

Update unit test to check for properly encoded object parameter (note
that it matches what `gsutil -D rm ...` is doing).

Issue googleapis#6352 is probably a duplicate of googleapis#6510.
jamesvl added a commit to jamesvl/elixir-google-api that referenced this issue Jan 28, 2021
Simple exemption for that parameter, since it appears to be the only one
affected.

Update unit test to check for properly encoded object parameter (note
that it matches what `gsutil -D rm ...` is doing).

Issue googleapis#6352 is probably a duplicate of googleapis#6510.
jamesvl added a commit to jamesvl/elixir-google-api that referenced this issue Jan 28, 2021
Simple exemption for that parameter, since it appears to be the only one
affected.

Update unit test to check for properly encoded object parameter (note
that it matches what `gsutil -D rm ...` is doing).

Issue googleapis#6352 is probably a duplicate of googleapis#6510.
@yoshi-automation yoshi-automation added 🚨 This issue needs some love. and removed 🚨 This issue needs some love. labels Jan 31, 2021
@dazuma
Copy link
Member

dazuma commented Mar 9, 2021

Fixed in #7159. Will regenerate and rerelease in the next couple days.

@dazuma dazuma closed this as completed Mar 9, 2021
@davidye
Copy link

davidye commented May 11, 2021

Looks like this is still broken for storage_objects_copy and storage_objects_rewrite

URI.encode(destination_object, &(URI.char_unreserved?(&1) || &1 == ?/))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

6 participants