angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

Location Hashbang is decoded befre it is split

Open rikkertkoppes opened this issue 13 years ago • 8 comments

For hashbang urls, the path is decoded when assigned. This results in paths containing a %2F being split incorrectly

https://github.com/angular/angular.js/blob/master/src/ng/location.js#L183

For example the hashbang #!/foo/bar%2Fbaz will not be matched by /:one/:two

rikkertkoppes avatar Feb 18 '13 15:02 rikkertkoppes

The same issue applies, when passing urls in the path.

As a quick workaround, I ended up double escaping urls before using them in hashbang urls.

moritzschepp avatar Feb 18 '13 19:02 moritzschepp

would love to see this fixed!

nicolacity avatar Jul 15 '13 02:07 nicolacity

There have been extensive changes to this service over the last few months. Can you confirm that this still happens on master and that the line linked to above is accurate?

petebacondarwin avatar Jul 15 '13 10:07 petebacondarwin

I will in the next few days. Sorry for the late reply.

moritzschepp avatar Aug 01 '13 12:08 moritzschepp

I checked with the latest stable and it was still there, but ran into a weird exception when trying to check against head. Haven't had a chance to try again since then, sorry! Thanks for looking into it @lavieenrose

nicolacity avatar Aug 01 '13 21:08 nicolacity

I just checked and the issue is not there anymore with 1.2.0rc1. I checked setting and getting an url param within the hash fragment, both worked out nicely. Thanks for fixing it!

moritzschepp avatar Aug 18 '13 20:08 moritzschepp

Hi, we just upgraded to 1.2.3 and got some problems with double decoded $routeParams. An URL containing "/%253A" (double encoded ":") is decoded back to /: instead of /%3A

Parts of the already decoded $location.path() is decoded again here: https://github.com/angular/angular.js/blob/master/src/ngRoute/route.js#L476

This was introduced in this commit: https://github.com/angular/angular.js/commit/04cebcc133c8b433a3ac5f72ed19f3631778142b

Just removing the decodeUriComponent() (or encoding data sent to $locaiton.path) fixes the problem for us

Addeventure avatar Dec 06 '13 23:12 Addeventure

@Addeventure if this is still an issue in master please file a new issue. Thanks!

btford avatar Mar 27 '14 21:03 btford