luci-base: uci.js: do not issue malformed uci/delete requests
Fixes: #3912
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit ec3a202b69b5bf5785c0785b2ac39efbe5cae2b7)
(cherry picked from commit 6ae1cd8fdb
)
This commit is contained in:
parent
96e3a03d8e
commit
30c1e5b260
1 changed files with 5 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue