summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDarius <darius.joksas@teltonika.lt>2018-09-26 10:59:08 +0300
committerJo-Philipp Wich <jo@mein.io>2018-09-29 14:01:49 +0200
commite5071c88f07f933521e39125cebba7244e94d760 (patch)
tree7d02c6cf3920b7adba5c13059e4a05e9aeacb0aa
parentf0141773ac9f26f0d8b291006c6c1e01c29c0ef7 (diff)
luci-base: cbi.lua: fix TypedSection.parse()
It's not necessary to execute all code if section already exists. Signed-off-by: Darius Joksas <jok.darius@gmail.com> [reword commit message, squash commits, remove stray semicolon] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--modules/luci-base/luasrc/cbi.lua23
1 files changed, 12 insertions, 11 deletions
diff --git a/modules/luci-base/luasrc/cbi.lua b/modules/luci-base/luasrc/cbi.lua
index d275c5b27..971830fe8 100644
--- a/modules/luci-base/luasrc/cbi.lua
+++ b/modules/luci-base/luasrc/cbi.lua
@@ -1199,19 +1199,20 @@ function TypedSection.parse(self, novld)
if name then
-- Ignore if it already exists
if self:cfgvalue(name) then
- name = nil;
- end
-
- name = self:checkscope(name)
-
- if not name then
+ name = nil
self.err_invalid = true
- end
+ else
+ name = self:checkscope(name)
+
+ if not name then
+ self.err_invalid = true
+ end
- if name and #name > 0 then
- created = self:create(name, origin) and name
- if not created then
- self.invalid_cts = true
+ if name and #name > 0 then
+ created = self:create(name, origin) and name
+ if not created then
+ self.invalid_cts = true
+ end
end
end
end