From 60f9eb4aa2c8bf8e0f07f9664af91740ea0616ca Mon Sep 17 00:00:00 2001 From: Ryan Florence Date: Tue, 7 Oct 2014 14:38:15 -0600 Subject: [PATCH] [fixed] encoded ampersands in query params fixes #343 --- modules/utils/Path.js | 2 +- modules/utils/__tests__/Path-test.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/utils/Path.js b/modules/utils/Path.js index e942e94847..9fb814e222 100644 --- a/modules/utils/Path.js +++ b/modules/utils/Path.js @@ -112,7 +112,7 @@ var Path = { * in the given path, null if the path contains no query string. */ extractQuery: function (path) { - var match = decodeURL(path).match(queryMatcher); + var match = path.match(queryMatcher); return match && qs.parse(match[1]); }, diff --git a/modules/utils/__tests__/Path-test.js b/modules/utils/__tests__/Path-test.js index c2dfbaa9d5..1766012a34 100644 --- a/modules/utils/__tests__/Path-test.js +++ b/modules/utils/__tests__/Path-test.js @@ -229,6 +229,10 @@ describe('Path.extractQuery', function () { it('properly handles arrays', function () { expect(Path.extractQuery('/?id%5B%5D=a&id%5B%5D=b')).toEqual({ id: [ 'a', 'b' ] }); }); + + it('properly handles encoded ampersands', function () { + expect(Path.extractQuery('/?id=a%26b')).toEqual({ id: 'a&b' }); + }); }); describe('when the path does not contain a query string', function () {