mirror of
https://gitlab.com/KevinRoebert/ClearUrls
synced 2025-12-15 21:55:36 +07:00
Fixed URLSearchParams spaces (x sign) bug
See also https://gitlab.com/ClearURLs/ClearUrls/-/merge_requests/108
This commit is contained in:
@@ -337,3 +337,21 @@ async function sha256(message) {
|
||||
function randomASCII(len) {
|
||||
return [...Array(len)].map(() => (~~(Math.random() * 36)).toString(36)).join('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an URLSearchParams as string.
|
||||
* Does handle spaces correctly.
|
||||
*/
|
||||
function urlSearchParamsToString(searchParams) {
|
||||
const rtn = []
|
||||
|
||||
searchParams.forEach((value, key) => {
|
||||
if (value) {
|
||||
rtn.push(key + '=' + value)
|
||||
} else {
|
||||
rtn.push(key)
|
||||
}
|
||||
})
|
||||
|
||||
return rtn.join('&')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user