Fix parsing of query string variables

This space that was added here was added to the parsed value of the
query variable. This broke any comparisons with the value, for example
"myvar=true" resulted in a value of "true ".

This was broken by f796b05e42

The commit also adds unit tests for webutil.getConfigVar() that will
detect problems like this in the future.
This commit is contained in:
Samuel Mannehed
2021-09-07 22:06:43 +02:00
parent 7841037618
commit f69d55c02f
3 changed files with 44 additions and 2 deletions

View File

@@ -122,7 +122,7 @@
// Note that we use location.href instead of location.search
// because Firefox < 53 has a bug w.r.t location.search
const re = new RegExp('.*[?&]' + name + '=([^&#]*)'),
match = ''.concat(document.location.href, " ", window.location.hash).match(re);
match = ''.concat(document.location.href, window.location.hash).match(re);
if (match) {
// We have to decode the URL since want the cleartext value