fix: parsing payload when registering push notification subscriptions

This commit is contained in:
Eana Hufwe 2024-05-25 00:42:52 +00:00
parent 65ce56cc08
commit ffa53c61fa

View file

@ -26,10 +26,11 @@ function normalizeObjectArgs(q: Record<string, string>) {
if (k.endsWith("]")) { if (k.endsWith("]")) {
const segments = k.split("[").map((p) => p.replace(/]$/g, "")); const segments = k.split("[").map((p) => p.replace(/]$/g, ""));
let d = dict; let d = dict;
for (let i = 0; i < segments.length - 1; i++) { for (let i = 0; i < segments.length - 2; i++) {
if (!(segments[i] in d)) d[segments[i]] = {}; if (!(segments[i] in d)) d[segments[i]] = {};
d = d[segments[i]]; d = d[segments[i]];
} }
d[segments[segments.length - 1]] = q[k];
} else { } else {
dict[k] = q[k]; dict[k] = q[k];
} }