From: Jo-Philipp Wich Date: Fri, 16 Apr 2021 15:29:32 +0000 (+0200) Subject: luci-base: form.js: fix AbstractValue.textvalue() for uci list options X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=d763f9767ecb4ad4383c967948a34fa477b543f8;p=project%2Fluci.git 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 (cherry picked from commit 5c792aefc744d1417fc9e24cfb92cd61cf8a651f) --- diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index b92ef235a4..72b4173493 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -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; },