mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-19 13:55:21 +00:00
Merge branch 'search-params-decoding' of https://github.com/mrkishi/sapper into mrkishi-search-params-decoding
This commit is contained in:
@@ -90,8 +90,8 @@ export function select_route(url: URL): Target {
|
|||||||
const query: Record<string, string | true> = {};
|
const query: Record<string, string | true> = {};
|
||||||
if (url.search.length > 0) {
|
if (url.search.length > 0) {
|
||||||
url.search.slice(1).split('&').forEach(searchParam => {
|
url.search.slice(1).split('&').forEach(searchParam => {
|
||||||
const [, key, value] = /([^=]+)(?:=(.*))?/.exec(searchParam);
|
const [, key, value] = /([^=]*)(?:=(.*))?/.exec(searchParam);
|
||||||
query[key] = decodeURIComponent((value || '').replace(/\+/g, ' '));
|
query[decodeURIComponent(key)] = decodeURIComponent((value || '').replace(/\+/g, ' '));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return { url, path, page, match, query };
|
return { url, path, page, match, query };
|
||||||
|
|||||||
Reference in New Issue
Block a user