Skip to content

Commit 83c8f59

Browse files
committed
[fixed] Allow special characters in query
Previously, special characters in query were left as is, potentially overwriting other query parameters and causing ambiguity. Now, they are properly escaped. Fixes remix-run#804.
1 parent 911073a commit 83c8f59

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

modules/utils/Path.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ var Path = {
133133
var queryString = qs.stringify(query, { indices: false });
134134

135135
if (queryString)
136-
return Path.withoutQuery(path) + '?' + decodeURIComponent(queryString);
136+
return Path.withoutQuery(path) + '?' + queryString;
137137

138138
return path;
139139
},

modules/utils/__tests__/Path-test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,10 @@ describe('Path.withQuery', function () {
318318
it('merges two query strings', function () {
319319
expect(Path.withQuery('/path?a=b', { c: [ 'd', 'e' ] })).toEqual('/path?a=b&c=d&c=e');
320320
});
321+
322+
it('handles special characters', function () {
323+
expect(Path.withQuery('/path?a=b', { c: [ 'd#e', 'f&a=i#j+k' ] })).toEqual('/path?a=b&c=d%23e&c=f%26a%3Di%23j%2Bk');
324+
});
321325
});
322326

323327
describe('Path.normalize', function () {

0 commit comments

Comments
 (0)