From 3451d533e561b186ed38ff50ff3d5b0c58aede17 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 21 Nov 2012 18:36:43 +0000 Subject: applications/luci-commands: improve dashboard html, remove inline styles, fix layout for both openwrt and bootstrap themes, use command basename when naming output download --- applications/luci-commands/luasrc/controller/commands.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'applications/luci-commands/luasrc/controller') 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 -- cgit v1.2.3