-
Notifications
You must be signed in to change notification settings - Fork 327
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
GM_getResourceURI encodes URI twice #1151
Comments
The title of this issue is misleading. When I read it I thought you meant the file is being encoded twice with the same type of encoding. Anyway, once the file has been Base64 encoded, the URI encoding is probably unnecessary. |
I'm -1 for changing GM_getResourceURL at this point, because we don't have evidence that it won't affect existing user scripts, and there is a note in the docs for this api, which says:
|
It's GM_getResourceURL btw, not GM_getResourceURI, no big deal though. |
I see three options:
I'm +1 for 1, 0 for 2, and 0 for 3. |
we don't have evidence that it won't affect existing user scriptsI did a little research and found this on wikipedia.org: Using standard Base64 in URL requires encoding of '+' and '/' characters into special percent-encoded hexadecimal sequences ('+' = '%2B' and '/' = '%2F'), which makes the string unnecessarily longer.So it looks like we do need the URI encoding. I'm surprised the mp3 won't work without decoding the url. |
There are two factors that lead up to this submission:
Because both of these don't blend well with each other, this produces a sole instance where it is required to decode a resource. My suggestion is as follows:
|
Docs updated. http://wiki.greasespot.net/GM_getResourceURL#Returns Otherwise, no change, for backwards compatibility. And although I can't find a reference that definitively says this is right, I can't find one that says it's wrong either, and it feels right to me. (You've gotta escape special characters -- it's just not clear if + and / are "special" in this context or not.) |
GM_getResourceURI encodes a URI resource in both Base64 and through URI encoding, so the resulting sound file must be put through decodeURIComponent() in order to get a usable result for audio files being inserted into embeds. Below is an example.
The text was updated successfully, but these errors were encountered: