Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

decodeURIComponent - prevent URIError #13993

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

decodeURIComponent - prevent URIError #13993

wants to merge 1 commit into from

Conversation

modmac
Copy link

@modmac modmac commented Feb 10, 2016

Replace decodeURIComponent with tryDecodeURIComponent to prevent throwing "URIError: malformed URI sequence".

https://github.com/angular/angular.js/blob/master/src/Angular.js#L1275

Replace decodeURIComponent with tryDecodeURIComponent to prevent throwing "URIError: malformed URI sequence".

https://github.com/angular/angular.js/blob/master/src/Angular.js#L1275
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

1 similar comment
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@modmac
Copy link
Author

modmac commented Feb 10, 2016

I signed it!

2016-02-10 15:34 GMT+01:00 googlebot notifications@github.com:

Thanks for your pull request. It looks like this may be your first
contribution to a Google open source project. Before we can look at your
pull request, you'll need to sign a Contributor License Agreement (CLA).

[image: 📝] Please visit https://cla.developers.google.com/
https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll

verify. Thanks.


Reply to this email directly or view it on GitHub
#13993 (comment).

@googlebot
Copy link

CLAs look good, thanks!

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

@gkalpak
Copy link
Member

gkalpak commented Feb 10, 2016

I think this will break the contract that $location.path() or $location.hash() return a string.
OOC, under what circumstances can this error been thrown ? Do you have a reproduction.

There should also be some tests, verifying the new behavior and guarding against regressions.

@modmac
Copy link
Author

modmac commented Feb 11, 2016

Yes, try to request a page with a #% hash in the URL.

Example:
https://console.developers.google.com/freetrial?newProject=false#%

Maybe in this example, if decodeURIComponent throws an error, we should catch it and encode hash/uri to keep wrong characters (ex. single %) as encoded UTF?

@gkalpak
Copy link
Member

gkalpak commented Feb 11, 2016

Aha, I see the error.

TBH, trying to guess and fix unencoded UTF characters is a business I'd rather not be into :)
That said, silently failing on invalid URLs, won't be fun to debug. I think it's better to throw here.

@petebacondarwin, wdyt ?

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

Successfully merging this pull request may close these issues.

None yet

3 participants