angular/angular.js — pull request #5746 by Pasvaz (2014-01-11 22:10:41+00:00)
Title: fix(ngRoute): wrong redirect to paths containing optional or special parameters

When the path contains optional parameters `?` or special parameters `*` the redirects to those routes are broken, the location will end with the relative encoded character.

To reproduce the issue:
* create a route with optional parameters, es. `$routeProvider.when('/profile/:userId?', ...)`
* angular will add the automatic redirect with or without the trailing **/**, in this case `'/profile/:userId?/'`
* point your browser to the redirect `http://localhost/#!/profile/0/`, you'll see the encoded `? (%3F)` at the end of the url: `http://localhost/#!/profile/0%3F`

Happens also for the special parameters `*` and also for the opposite scenario, when the route has the ending **/** (`/profile/:userId?/`) and you browse the url without slash `/profile/0`. It affects every redirect that uses the function interpolate in combination with special parameters.