From 5c792aefc744d1417fc9e24cfb92cd61cf8a651f Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 16 Apr 2021 17:29:32 +0200 Subject: [PATCH] luci-base: form.js: fix AbstractValue.textvalue() for uci list options 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 --- modules/luci-base/htdocs/luci-static/resources/form.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 58a31dddb2..f7b4c64f8f 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -1862,6 +1862,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; }, -- 2.30.2