1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Merge pull request #14271 from calixteman/params

Parse query string in using URLSearchParams
This commit is contained in:
Jonas Jenwald 2021-11-13 22:59:34 +01:00 committed by GitHub
commit 7a428345db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 18 deletions

View file

@ -187,11 +187,8 @@ function watchScroll(viewAreaElement, callback) {
*/
function parseQueryString(query) {
const params = new Map();
for (const part of query.split("&")) {
const param = part.split("="),
key = param[0].toLowerCase(),
value = param.length > 1 ? param[1] : "";
params.set(decodeURIComponent(key), decodeURIComponent(value));
for (const [key, value] of new URLSearchParams(query)) {
params.set(key.toLowerCase(), value);
}
return params;
}