mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
Merge pull request #4056 from Icinga/fix/js-url-param-parsing
Fix js url param parsing
This commit is contained in:
commit
7192d5fd6c
@ -133,7 +133,7 @@
|
|||||||
|
|
||||||
$.each(params, function (key, value) {
|
$.each(params, function (key, value) {
|
||||||
// We overwrite existing params
|
// We overwrite existing params
|
||||||
newparams[key] = value;
|
newparams[encodeURIComponent(key)] = encodeURIComponent(value);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Object.keys(newparams).length) {
|
if (Object.keys(newparams).length) {
|
||||||
@ -143,9 +143,9 @@
|
|||||||
queryString += '&';
|
queryString += '&';
|
||||||
}
|
}
|
||||||
|
|
||||||
queryString += encodeURIComponent(key);
|
queryString += key;
|
||||||
if (value !== null) {
|
if (value !== null) {
|
||||||
queryString += '=' + encodeURIComponent(value);
|
queryString += '=' + value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
result += queryString;
|
result += queryString;
|
||||||
@ -198,15 +198,28 @@
|
|||||||
segment = a.search.replace(/^\?/,'').split('&'),
|
segment = a.search.replace(/^\?/,'').split('&'),
|
||||||
len = segment.length,
|
len = segment.length,
|
||||||
i = 0,
|
i = 0,
|
||||||
s;
|
s,
|
||||||
|
key,
|
||||||
|
value,
|
||||||
|
equalPos;
|
||||||
|
|
||||||
for (; i < len; i++) {
|
for (; i < len; i++) {
|
||||||
if (!segment[i]) {
|
if (! segment[i]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
s = segment[i].split('=');
|
|
||||||
params[decodeURIComponent(s[0])] = typeof s[1] !== 'undefined' ? decodeURIComponent(s[1]) : null;
|
equalPos = segment[i].indexOf('=');
|
||||||
|
if (equalPos !== -1) {
|
||||||
|
key = segment[i].slice(0, equalPos);
|
||||||
|
value = segment[i].slice(equalPos + 1);
|
||||||
|
} else {
|
||||||
|
key = segment[i];
|
||||||
|
value = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
params[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return params;
|
return params;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user