Skip to content

Commit

Permalink
[fixed] encoded ampersands in query params
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanflorence committed Oct 7, 2014
1 parent acc00f7 commit 60f9eb4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/utils/Path.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
},

Expand Down
4 changes: 4 additions & 0 deletions modules/utils/__tests__/Path-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit 60f9eb4

Please sign in to comment.