From 6ae1cd8fdbd438574270fa9586f40e223fec40e6 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) --- 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 f97cd8e35..e6582b3e2 100644 --- a/modules/luci-base/htdocs/luci-static/resources/uci.js +++ b/modules/luci-base/htdocs/luci-static/resources/uci.js @@ -553,9 +553,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