-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
public_url returning quoted_name with '/' #3809
Comments
Hi @jlvcm, |
Just to add, this also breaks The problem seems to be this line: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/storage/google/cloud/storage/blob.py#L1579 The |
Hitting this bug as well. |
Investigating: when I remove the @frankyn Can you please clarify whether the client libraries should be quoting the |
Apologies for the delay @tseaver. Clarifying question, does quoting in Python represent an |
Thanks for clarifying, I generated a public URL using the Cloud Console Storage browser and quoting doesn't occur there. I'll forward the question to GCS team just to make sure, but given the behavior mentioned in comment#3 it sounds reasonable that Thank you for your patience! |
Response from GCS team is the URL shouldn't be "quoted" unless there's a specific reason. I don't have enough context to understand why a test breaks when quoting is removed. Taking a look at the Ruby storage client library. When I generate a public_url, the result isn't quoted. require "google/cloud/storage"
storage = Google::Cloud::Storage.new
bucket = storage.bucket "bucket-name"
file = bucket.file "bucket-name"
puts file.public_url
=> "https://storage.googleapis.com/www.coderfrank.com/osdf/oijsd/sdfsdf/test.txt" |
Hmm, I guess we need to figure out where the test failures in #4716 are coming from, then. |
@frankyn Some evidence that the back-end actually wants the {'bucket': 'gcp-3809-1519337419615373',
'contentType': 'text/plain',
'crc32c': 'U35c9A==',
'etag': 'COy2x+fFutkCEAE=',
'generation': '1519337650379628',
'id': 'gcp-3809-1519337419615373/parent/child/filename.txt/1519337650379628',
'kind': 'storage#object',
'md5Hash': 'ogBPN3MLlEVnCnOPoPye5Q==',
'mediaLink': 'https://www.googleapis.com/download/storage/v1/b/gcp-3809-1519337419615373/o/parent%2Fchild%2Ffilename.txt?generation=1519337650379628&alt=media',
'metageneration': '1',
'name': 'parent/child/filename.txt',
'selfLink': 'https://www.googleapis.com/storage/v1/b/gcp-3809-1519337419615373/o/parent%2Fchild%2Ffilename.txt',
'size': '19',
'storageClass': 'STANDARD',
'timeCreated': '2018-02-22T22:14:10.217Z',
'timeStorageClassUpdated': '2018-02-22T22:14:10.217Z',
'updated': '2018-02-22T22:14:10.217Z'} If I dont use the escaped form when making API calls against the object (e.g., The fact that the |
So, it looks to me as though the correct resolution is to update |
Thanks Tres.
…On Thu, Feb 22, 2018 at 2:47 PM Tres Seaver ***@***.***> wrote:
So, it looks to me as though the correct resolution is to update
Blob.public_url (and maybe also Blob.generate_signed_url?) to avoid
quoting embedded / characters, but continue quoting them for all API
requests. I have updated #4716
<#4716>
accordingly.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3809 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAPUcy70fmvhoUT4FNTKcsX6Agu_oFhhks5tXe5jgaJpZM4O2qQv>
.
|
Oh gosh, that's confusing. So, it fails when you don't quote the object name during other operations. IIUC, then it would make sense to not quote "/" in the returned public_url and generated_signed_url instead. Thanks @tseaver! Apologies, that I wasn't much help here. |
@tseaver, I was able to find a better answer for this case. The existing client library uses the XML API endpoints defined by JSON API endpoint - As for this PR, for the recommendation is to not quote '/'. Rationale is based more on the ease of parsing '/' versus '%2F'. |
#4716 will close this issue when it merges. |
Thanks @tseaver ! I was OOO yesterday. Cheers! |
Maybe it's a regression, but I still get encoded slashes (%2F) in Blob.public_url in gcloud 0.18.3. I un-encode them manually for the moment, but inconsistency (for example with the console's public URL) is not desirable imho. Should this be re-opened? Or a new Issue? |
Hi @atteneder, Openning a new issue, thank you for raising this issue. |
i'm adding my files inside folders, so i give the blob name as
"UUID/file.ext"
, but when i request the public_url() i get the fullname as quoted example:".../MYBUCKET/UUID%2Ffile.ext"
both
"%2F"
and"/"
in the link downloads the same file, but with different namesThe text was updated successfully, but these errors were encountered: