Skip to content

Commit dc24062

Browse files
committed
fix: make sure query params are encoded
1 parent a58fc91 commit dc24062

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

modules/RouteNode.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,14 @@ export default class RouteNode {
204204

205205
const searchPart = !searchParams.length ? null : searchParams
206206
.filter(p => Object.keys(params).indexOf(withoutBrackets(p)) !== -1)
207-
.map(p => Path.serialise(p, params[withoutBrackets(p)]))
207+
.map(p => {
208+
const val = params[withoutBrackets(p)];
209+
const encodedVal = Array.isArray(val)
210+
? val.map(encodeURIComponent)
211+
: encodeURIComponent(val);
212+
213+
return Path.serialise(p, encodedVal);
214+
})
208215
.join('&');
209216

210217
return segments

0 commit comments

Comments
 (0)