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)
This commit is contained in:
parent
d0daa2c47b
commit
6ae1cd8fdb
1 changed files with 5 additions and 1 deletions
|
@ -553,9 +553,13 @@ return baseclass.extend(/** @lends LuCI.uci.prototype */ {
|
||||||
c[conf][sid] = {};
|
c[conf][sid] = {};
|
||||||
|
|
||||||
/* undelete option */
|
/* 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 });
|
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;
|
c[conf][sid][opt] = val;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue