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: https://git.librecmc.org/?a=commitdiff_plain;h=6ae1cd8fdbd438574270fa9586f40e223fec40e6;p=oweals%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) --- 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 {