Skip to content
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

'new goog.Uri' throws exceptions on certain types of URIs #53

Closed
nanaze opened this issue Apr 15, 2014 · 1 comment
Closed

'new goog.Uri' throws exceptions on certain types of URIs #53

nanaze opened this issue Apr 15, 2014 · 1 comment

Comments

@nanaze
Copy link
Contributor

nanaze commented Apr 15, 2014

This issue was imported from Closure Library's previous home at http://closure-library.googlecode.com

The link to the original issue is:
https://code.google.com/p/closure-library/issues/detail?id=566

@joeltine
Copy link
Contributor

joeltine commented Aug 5, 2015

TL;DR any URIs encoded via escape() have the potential to throw. escape() encodes them in a format not compatible with the standard decodeURIComponent, and has been deprecated since ~2000.

One potential fix here is to find/replace any escape() encodings that deviate from the standard UTF-8 encodings. From ref-urlencode, it seems to be approximately %80 through %FF.

From the original issue:

Most types of malformed URIs are handled incorrectly, but this one throws an exception:

var uri = new goog.Uri(
    'http://www.cpdee.ufmg.br/~elt/docs/DSP/Microsoft%20PowerPoint' +     
    '%20%20Aula_01_Aritm%E9tica.pdf')

decodeURIComponent blows up trying to decode it.

More concretely decodeURIComponent('%E9') throws.

escape('é') -> "%E9"
encodeURIComponent('é') -> "%C3%A9"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants