-
Couldn't load subscription status.
- Fork 322
Description
Hi!
I'm having a problem with URLs not getting escaped correctly. I might have missed something, but it seems like it could be related to a recent change you made to the way you escape URLs: f149ba1#diff-e7632c024955e4a1dc429d3253cbe6bcR584
The smart_escape function used to escape URLs this way:
smart_escape = (string)->
encodeURIComponent(string).replace(/%3A/g, ":").replace(/%2F/g, "/")
Now, it escapes URLs this way:
smart_escape = (string, unsafe = /([^a-zA-Z0-9_.\-\/:]+)/g)->
string.replace unsafe, (match)->
match.split("").map((c)-> "%"+c.charCodeAt(0).toString(16).toUpperCase()).join("")
I have a case where the public_id is Snø_dfom5q. The new escape function produces Sn%F8_dfom5q, while the old, and in this case correct function, produces Sn%C3%B8_dfom5q.
The complete URLs:
http://res.cloudinary.com/hanen/image/upload/Sn%F8_dfom5q.png
http://res.cloudinary.com/hanen/image/upload/Sn%C3%B8_dfom5q.png
If I try to open the new URL (the first one in the list above) I get the following error:
<Error>
<Code>InvalidURI</Code>
<Message>Couldn't parse the specified URI.</Message>
<URI>
/cloudinary_data/res/hanen/image/upload/c_limit,h_200,w_200/Sn%F8_dfom5q.png
</URI>
<RequestId>92E2AA6CF6053C21</RequestId>
<HostId>
T9+GP9naEm0RSFY1aYSn8qGNvmlll7BE97odtnHL2c5du40aR4RQPrTsyvbNOPxh2+fDRLCPxG0=
</HostId>
</Error>
I'm not an expert on URL escaping, so it's hard for me know your thinking behind your recent change and create a PR. But let me know if I can help in any way.