-
Notifications
You must be signed in to change notification settings - Fork 369
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
File.publicUrl() unexpectedly escapes forward slashes in > 7.6.0 #2419
Comments
Thanks for reporting this issue @Jeanno. This code path hasn't changed in some time so I am wondering if perhaps something changed on the node side. Did you recently change versions? Can you provide me with the version you are currently using? |
I can confirm that I have the same problem on my end using Node 20. I noticed that the last version without the problem is == |
I didn't change my node version (for at least a few months). The issue broken my production which I had to roll back immediately. My development node version: node 21 |
Excellent thank you @HAuzian this will help me track down what happened. |
See my original note #1824 (comment). Is this encoding causing an issue or is it just a readability problem as noted in this issue? |
@ddelgrosso1, thanks for linking the note providing context. The change makes perfect sense. At least in my case, the result from |
It took down my services in production as URLs from GCS are split by "/". I wrote my workaround so it's fine for me for now. I'm sure there will be a lot of similar cases out there so when they upgrade their dependencies it will again cause some outages. |
Being as this appears to be working as intended. Going to close this issue out. If there are any other questions or concerns, please feel free to reopen / open a new issue. |
Hi @ddelgrosso1 thanks for taking a look at this. But I still think the resolution contradicts with the object naming guideline that you referenced to in the other issue.
And specifically,
On the other hand, the public urls shown on Google Cloud Console are Given the above, I think the change does not make sense to me. Perhaps I'm missing something here but would appreciate if someone could point that out for me. |
Let me take another look and see if I can improve on what was done. |
Just some notes from poking around at this a bit, as noted the library currently encodes To fix this properly we may need to split the name based on pathing characters, encode the individual pieces (folders / paths can contain encodable characters), and rejoin the encoded pieces using the pathing character. I also need to check if we would want to hold off on this until the next major version update as it would likely be breaking (although one could argue it is a bug fix). Will update accordingly. |
Summary
Forward slashes are escaped to "%2F" in
File.publicUrl()
for files that are > 1 level deep.Unexpected result: "https://storage.googleapis.com/bucketId/path%2Fto%2Ffile"
Expected result: "https://storage.googleapis.com/bucketId/path/to/file"
The expected result is given before <= 6.5.4. So this issue looks like a regression.
Environment details
@google-cloud/storage
version: > 7.6.0Steps to reproduce
Unexpected result: "https://storage.googleapis.com/bucketId/path%2Fto%2Ffile"
Expected result: "https://storage.googleapis.com/bucketId/path/to/file"
Additional info
There was an identical bug in the python library.
googleapis/google-cloud-python#3809
The text was updated successfully, but these errors were encountered: