luci-base: form.js: fix AbstractValue.textvalue() for uci list options
authorJo-Philipp Wich <jo@mein.io>
Fri, 16 Apr 2021 15:29:32 +0000 (17:29 +0200)
committerJo-Philipp Wich <jo@mein.io>
Fri, 16 Apr 2021 15:33:04 +0000 (17:33 +0200)
Serialize the uci list value into a space separated string before passing
it to String.format() for HTML escaping. Without that change, empty strings
were returned whenever the underlying uci get operation yieled an array.

Fixes: #4993
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 5c792aefc744d1417fc9e24cfb92cd61cf8a651f)

modules/luci-base/htdocs/luci-static/resources/form.js

index b92ef235a4638c6febb58afa162fd209f805d8d1..72b41734932f614a80856329b30a651403c16fc9 100644 (file)
@@ -1693,6 +1693,9 @@ var CBIAbstractValue = CBIAbstractElement.extend(/** @lends LuCI.form.AbstractVa
                if (cval == null)
                        cval = this.default;
 
+               if (Array.isArray(cval))
+                       cval = cval.join(' ');
+
                return (cval != null) ? '%h'.format(cval) : null;
        },