From: Steven Barth Date: Sat, 20 Jun 2009 07:14:36 +0000 (+0000) Subject: Merge fixes / improvements X-Git-Tag: 0.10.0~1534 X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=341f757255caa08ee2922a3f32a00849e306f23c Merge fixes / improvements --- diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua index 0265301f7..e513053ba 100644 --- a/libs/cbi/luasrc/cbi.lua +++ b/libs/cbi/luasrc/cbi.lua @@ -1287,6 +1287,11 @@ function AbstractValue.parse(self, section, novld) else self.error = { [section] = "invalid" } end + if self.section.error then + table.insert(self.section.error[section], "invalid") + else + self.section.error = {[section] = {"invalid"}} + end self.map.save = false end if fvalue and not (fvalue == cvalue) then diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index 73daeaf17..71d2a5c74 100644 --- a/libs/web/luasrc/dispatcher.lua +++ b/libs/web/luasrc/dispatcher.lua @@ -264,7 +264,9 @@ function dispatch(request) local user if sdat then - sdat = loadstring(sdat)() + sdat = loadstring(sdat) + setfenv(sdat, {}) + sdat = sdat() if not verifytoken or ctx.urltoken.stok == sdat.token then user = sdat.user end @@ -657,18 +659,22 @@ local function _cbi(self, ...) end end + local function _resolve_path(path) + return type(path) == "table" and build_url(unpack(path)) or path + end + if config.on_valid_to and state and state > 0 and state < 2 then - http.redirect(config.on_valid_to) + http.redirect(_resolve_path(config.on_valid_to)) return end if config.on_changed_to and state and state > 1 then - http.redirect(config.on_changed_to) + http.redirect(_resolve_path(config.on_changed_to)) return end if config.on_success_to and state and state > 0 then - http.redirect(config.on_success_to) + http.redirect(_resolve_path(config.on_success_to)) return end