From: Jo-Philipp Wich Date: Tue, 14 Apr 2020 15:02:42 +0000 (+0200) Subject: luci-base: uci.js: do not issue malformed uci/delete requests X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=30c1e5b26043714900b0b776ddfd8a93835ce806;p=project%2Fluci.git luci-base: uci.js: do not issue malformed uci/delete requests Fixes: #3912 Signed-off-by: Jo-Philipp Wich (cherry picked from commit ec3a202b69b5bf5785c0785b2ac39efbe5cae2b7) (cherry picked from commit 6ae1cd8fdbd438574270fa9586f40e223fec40e6) --- diff --git a/modules/luci-base/htdocs/luci-static/resources/uci.js b/modules/luci-base/htdocs/luci-static/resources/uci.js index 916dbb310b..6bbd1bc37c 100644 --- a/modules/luci-base/htdocs/luci-static/resources/uci.js +++ b/modules/luci-base/htdocs/luci-static/resources/uci.js @@ -547,9 +547,13 @@ return baseclass.extend(/** @lends LuCI.uci.prototype */ { c[conf][sid] = {}; /* undelete option */ - if (d[conf] && d[conf][sid]) + if (d[conf] && d[conf][sid]) { d[conf][sid] = d[conf][sid].filter(function(o) { return o !== opt }); + if (d[conf][sid].length == 0) + delete d[conf][sid]; + } + c[conf][sid][opt] = val; } else {