Skip to content

Commit

Permalink
fix($urlMatcherFactory): "string" type now encodes/decodes slashes
Browse files Browse the repository at this point in the history
fixes #1119
  • Loading branch information
christopherthielen committed Nov 9, 2014
1 parent 7344342 commit 3045e41
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/urlMatcherFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,8 @@ function $UrlMatcherFactory() {

var isCaseInsensitive = false, isStrictMode = true, defaultSquashPolicy = "nosquash";

function valToString(val) { return val != null ? val.toString() : val; }
function valToString(val) { return val != null ? val.toString().replace("/", "%2F") : val; }
function valFromString(val) { return val != null ? val.toString().replace("%2F", "/") : val; }
function angularEquals(left, right) { return angular.equals(left, right); }
// TODO: in 1.0, make string .is() return false if value is undefined by default.
// function regexpMatches(val) { /*jshint validthis:true */ return isDefined(val) && this.pattern.test(val); }
Expand All @@ -527,7 +528,7 @@ function $UrlMatcherFactory() {
var $types = {}, enqueue = true, typeQueue = [], injector, defaultTypes = {
string: {
encode: valToString,
decode: valToString,
decode: valFromString,
is: regexpMatches,
pattern: /[^/]*/
},
Expand Down

0 comments on commit 3045e41

Please sign in to comment.