Cloudflare R2 public bucket urls with %27 not found

Urls with %27 in the file name are not being found
19 Replies
Řambo
ŘamboOP2y ago
Řambo
ŘamboOP2y ago
Řambo
ŘamboOP2y ago
only the ones with %27 are getting 404 error. the rest work fine
yat
yat2y ago
why there is a %27 in the file name
Řambo
ŘamboOP2y ago
its a single quote
yat
yat2y ago
ooh url encoding is the reason ig u can't use quote in filename
Řambo
ŘamboOP2y ago
ya thats what i was thinking. is that cloudflare related thing?
yat
yat2y ago
i don't think so it's just how browsers work
Řambo
ŘamboOP2y ago
cuz looks here. this works just fine https://static.wikia.nocookie.net/leagueoflegends/images/7/70/Kai%27Sa_Select.ogg its using %27 as the single quote so i dont understand why it wouldnt work
yat
yat2y ago
maybe the way how cloudflare encode the file names ?
Řambo
ŘamboOP2y ago
idk, maybe re-named to this Kai-Sa_Original_FilterOff_MoveFirst_6.ogg and it works. Wish there was a way for this to work so I won't have to go and change the names
yat
yat2y ago
i never saw someone using quotes tho it's very uncommon
Řambo
ŘamboOP2y ago
if anyone else knows an easy fix for this, please let me know. otherwise i'll just rename all the files
Erisa
Erisa2y ago
Hey @Řambo, I believe what's happening here is that R2 is decoding the %27 to ' before it looks it up in the bucket. Since you have %27 literally in your object name it won't see it when it looks for the one with ' after decoding that in the URL. The fix would be to have the filename unaltered in the bucket. I.e. set the filename of the object to Kai'Sa_Original_FilterOff_MoveFirst_6.ogg rather than the URL encoded form. That should be a valid filename Tried this with mine but quickly realised I'm using a Worker so it wont be the same, let me try with a pub bucket Works for me with that filename: https://pub-8fbfda42fe2145408e90b5315377f1a3.r2.dev/Kai'Sa_Select.ogg or https://pub-8fbfda42fe2145408e90b5315377f1a3.r2.dev/Kai%27Sa_Select.ogg both lead to the same object (since it's the same URL under the hood of the browser hiding it for you)
Erisa
Erisa2y ago
Řambo
ŘamboOP2y ago
i see, that makes sense. tysm
Erisa
Erisa2y ago
No problem 🙂 I will now have that voice ringing in my head for the rest of the day after my browser kept autoplaying it on the test urls 🤣
Řambo
ŘamboOP2y ago
are you the hunter, or the prey?

Did you find this page helpful?