Skip to content

Commit

Permalink
[fixed] Double-encoding of query strings
Browse files Browse the repository at this point in the history
Also, don't use indices in array query string values.

Fixes remix-run#721
  • Loading branch information
mjackson committed Jan 25, 2015
1 parent cc5490e commit fe5ec39
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions modules/utils/Path.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ var Path = {
if (existingQuery)
query = query ? merge(existingQuery, query) : existingQuery;

var queryString = query && qs.stringify(query);
var queryString = qs.stringify(query, { indices: false });

if (queryString)
return Path.withoutQuery(path) + '?' + queryString;
return Path.withoutQuery(path) + '?' + decodeURIComponent(queryString);

return path;
},
Expand Down
2 changes: 1 addition & 1 deletion modules/utils/__tests__/Path-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ describe('Path.withQuery', function () {
});

it('merges two query strings', function () {
expect(Path.withQuery('/path?a=b', { c: [ 'd', 'e' ]})).toEqual('/path?a=b&c%5B0%5D=d&c%5B1%5D=e');
expect(Path.withQuery('/path?a=b', { c: [ 'd', 'e' ] })).toEqual('/path?a=b&c=d&c=e');
});
});

Expand Down

0 comments on commit fe5ec39

Please sign in to comment.