diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2012-11-21 18:36:43 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2012-11-21 18:36:43 +0000 |
commit | 3451d533e561b186ed38ff50ff3d5b0c58aede17 (patch) | |
tree | 737f533f9e964d9cb5623ddef404b7c77ec52bc5 /applications/luci-commands/luasrc/controller/commands.lua | |
parent | 1a530635c930a7a23b6ff941c89365dd5e692198 (diff) |
applications/luci-commands: improve dashboard html, remove inline styles, fix layout for both openwrt and bootstrap themes, use command basename when naming output download
Diffstat (limited to 'applications/luci-commands/luasrc/controller/commands.lua')
-rw-r--r-- | applications/luci-commands/luasrc/controller/commands.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/applications/luci-commands/luasrc/controller/commands.lua b/applications/luci-commands/luasrc/controller/commands.lua index cd921f9f2c..9fbde94c6a 100644 --- a/applications/luci-commands/luasrc/controller/commands.lua +++ b/applications/luci-commands/luasrc/controller/commands.lua @@ -195,6 +195,7 @@ function action_run(...) end function action_download(...) + local fs = require "nixio.fs" local argv = parse_cmdline(...) if argv then local fd = io.popen(table.concat(argv, " ") .. " 2>/dev/null") @@ -203,11 +204,11 @@ function action_download(...) local name if chunk:match("[%z\1-\8\14-\31]") then luci.http.header("Content-Disposition", "attachment; filename=%s" - % argv[1]:gsub("%W+", ".") .. ".bin") + % fs.basename(argv[1]):gsub("%W+", ".") .. ".bin") luci.http.prepare_content("application/octet-stream") else luci.http.header("Content-Disposition", "attachment; filename=%s" - % argv[1]:gsub("%W+", ".") .. ".txt") + % fs.basename(argv[1]):gsub("%W+", ".") .. ".txt") luci.http.prepare_content("text/plain") end |