From 30c1e5b26043714900b0b776ddfd8a93835ce806 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 14 Apr 2020 17:02:42 +0200 Subject: [PATCH] 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) --- modules/luci-base/htdocs/luci-static/resources/uci.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/uci.js b/modules/luci-base/htdocs/luci-static/resources/uci.js index 916dbb310..6bbd1bc37 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 { -- 2.25.1