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

ngRoute doesn't support "%" in URLs, throws URI malformed #6326

Closed
mllrjb opened this issue Feb 18, 2014 · 0 comments
Closed

ngRoute doesn't support "%" in URLs, throws URI malformed #6326

mllrjb opened this issue Feb 18, 2014 · 0 comments

Comments

@mllrjb
Copy link
Contributor

mllrjb commented Feb 18, 2014

It looks like ngRoute is doing an extra decodeURIComponent on the $location.$$path value that's passed in. If the path originally contained a URI encoded % (aka %25), then this causes an exception.

    URIError: URI malformed
        at decodeURIComponent (native)
        at switchRouteMatcher (/Users/jason/projects/sandbox/angular.js/src/ngRoute/route.js:469:17)
        at /Users/jason/projects/sandbox/angular.js/src/ngRoute/route.js:562:33

Reproducible: always
Browsers: Chrome 32, Firefox 26 and IE 10
Operating system: OS X

Steps to reproduce:

  • Configure a route with a parameter
      $routeProvider
        .when('/my/route/:param', {
          title: 'home.title',
          templateUrl: 'views/home.html',
          controller: 'HomeCtrl'
        })
  • Use a URI encoded URL to access the route

my/route/some%25route

mllrjb pushed a commit to mllrjb/angular.js that referenced this issue Feb 18, 2014
Since `$location.$$path` is already decoded, doing an extra `decodeURIComponent` is both unnecessary and can cause problems. Specifically, if the path originally included an encoded `%` (aka `%25`), then ngRoute will throw "URIError: URI malformed".

Closes angular#6326
mllrjb added a commit to mllrjb/angular.js that referenced this issue Feb 19, 2014
Since `$location.$$path` is already decoded, doing an extra `decodeURIComponent` is both unnecessary and can cause problems. Specifically, if the path originally included an encoded `%` (aka `%25`), then ngRoute will throw "URIError: URI malformed".

Closes angular#6326
mllrjb added a commit to mllrjb/angular.js that referenced this issue Feb 19, 2014
Since `$location.$$path` is already decoded, doing an extra `decodeURIComponent` is both unnecessary and can cause problems. Specifically, if the path originally included an encoded `%` (aka `%25`), then ngRoute will throw "URIError: URI malformed".

Closes angular#6326
@ashleygwilliams ashleygwilliams added this to the Backlog milestone Feb 21, 2014
petebacondarwin pushed a commit that referenced this issue Jul 15, 2014
Since `$location.$$path` is already decoded, doing an extra `decodeURIComponent` is both unnecessary
and can cause problems. Specifically, if the path originally includes an encoded `%` (aka `%25`),
then ngRoute will throw "URIError: URI malformed".

Closes #6326
Closes #6327
ckknight pushed a commit to ckknight/angular.js that referenced this issue Jul 16, 2014
Since `$location.$$path` is already decoded, doing an extra `decodeURIComponent` is both unnecessary
and can cause problems. Specifically, if the path originally includes an encoded `%` (aka `%25`),
then ngRoute will throw "URIError: URI malformed".

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

Successfully merging a pull request may close this issue.

3 participants