Skip to content

Commit

Permalink
trim keys in qsArgs function
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaccarthy committed Sep 15, 2024
1 parent 7da95a1 commit 9c03232
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ function qsArgs(key, str) {
let args = {};
try {
for (let [k, val] of new URLSearchParams(str))
args[k] = val;
args[k.trim()] = val;
} catch(err) {
console.error(err);
let qs = str.split("?")[1];
if (qs == null) return key ? null : {};
qs = qs.split("&");
for (let i=0;i<qs.length;i++) {
let a = qs[i].split("=");
args[a[0]] = decodeURIComponent(a[1]);
args[a[0].trim()] = decodeURIComponent(a[1]);
}
}
return key ? args[key] : args;
Expand Down

0 comments on commit 9c03232

Please sign in to comment.