Skip to content

Commit 3045e41

Browse files
fix($urlMatcherFactory): "string" type now encodes/decodes slashes
fixes #1119
1 parent 7344342 commit 3045e41

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/urlMatcherFactory.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,8 @@ function $UrlMatcherFactory() {
518518

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

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

0 commit comments

Comments
 (0)