summaryrefslogtreecommitdiffhomepage
path: root/applications
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2012-11-21 19:29:47 +0000
committerJo-Philipp Wich <jow@openwrt.org>2012-11-21 19:29:47 +0000
commit69ac1031b7e83fb68ee1f6f952890fc0654f54f8 (patch)
tree4f220decbd7c7e9a796431db67079e9687dc372b /applications
parentef8e4eb991a1b496085c57f6b8381b623311db89 (diff)
applications/luci-commands, applications/luci-upnp, modules/admin-core, modules/admin-full, modules/freifunk: clean up argument handling of leaf nodes
Diffstat (limited to 'applications')
-rw-r--r--applications/luci-commands/luasrc/controller/commands.lua7
-rw-r--r--applications/luci-upnp/luasrc/controller/upnp.lua6
2 files changed, 5 insertions, 8 deletions
diff --git a/applications/luci-commands/luasrc/controller/commands.lua b/applications/luci-commands/luasrc/controller/commands.lua
index 9fbde94c6..c04d186bb 100644
--- a/applications/luci-commands/luasrc/controller/commands.lua
+++ b/applications/luci-commands/luasrc/controller/commands.lua
@@ -141,9 +141,7 @@ local function parse_args(str)
end
local function parse_cmdline(cmdid, args)
- local uci = require "luci.model.uci".cursor()
- local path = luci.dispatcher.context.requestpath
-
+ local uci = require "luci.model.uci".cursor()
if uci:get("luci", cmdid) == "command" then
local cmd = uci:get_all("luci", cmdid)
local argv = parse_args(cmd.command)
@@ -228,7 +226,8 @@ end
function action_public(cmdid, args)
local uci = require "luci.model.uci".cursor()
- if uci:get("luci", cmdid) == "command" and
+ if cmdid and
+ uci:get("luci", cmdid) == "command" and
uci:get("luci", cmdid, "public") == "1"
then
action_download(cmdid, args)
diff --git a/applications/luci-upnp/luasrc/controller/upnp.lua b/applications/luci-upnp/luasrc/controller/upnp.lua
index c40493dab..b5eaad5c9 100644
--- a/applications/luci-upnp/luasrc/controller/upnp.lua
+++ b/applications/luci-upnp/luasrc/controller/upnp.lua
@@ -69,10 +69,8 @@ function act_status()
end
end
-function act_delete()
- local path = luci.dispatcher.context.requestpath
- local idx = tonumber(path[#path])
-
+function act_delete(idx)
+ idx = tonumber(idx)
if idx and idx > 0 then
luci.sys.call("iptables -t filter -D MINIUPNPD %d 2>/dev/null" % idx)
luci.sys.call("iptables -t nat -D MINIUPNPD %d 2>/dev/null" % idx)