diff --git a/modules/helpers/Path.js b/modules/helpers/Path.js index 114bc200c6..0fa709736e 100644 --- a/modules/helpers/Path.js +++ b/modules/helpers/Path.js @@ -88,7 +88,8 @@ var Path = { 'Missing "' + paramName + '" parameter for path "' + pattern + '"' ); - return URL.encode(params[paramName]); + // Preserve forward slashes. + return String(params[paramName]).split('/').map(URL.encode).join('/'); }); }, diff --git a/specs/Path.spec.js b/specs/Path.spec.js index 9bbf226274..b0cf65378d 100644 --- a/specs/Path.spec.js +++ b/specs/Path.spec.js @@ -144,6 +144,12 @@ describe('Path.injectParams', function () { expect(Path.injectParams(pattern, { id: 'one, two' })).toEqual('comments/one%2C+two/edit'); }); }); + + describe('and a param has a forward slash', function () { + it('preserves the forward slash', function () { + expect(Path.injectParams(pattern, { id: 'the/id' })).toEqual('comments/the/id/edit'); + }); + }); }); });