luci-app-nlbwmon: fix nil value concat
authorJo-Philipp Wich <jo@mein.io>
Tue, 2 Oct 2018 17:20:53 +0000 (19:20 +0200)
committerJo-Philipp Wich <jo@mein.io>
Tue, 2 Oct 2018 17:20:53 +0000 (19:20 +0200)
Do not concatenate the yet undefined mtime variable to avoid a controller
error with backtrace.

Fixes: b3642f476 ("luci-app-nlbwmon: add proper file names for json and csv exports.")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
applications/luci-app-nlbwmon/luasrc/controller/nlbw.lua

index d50b77d0f40894cfe53fafad86716d6e187eca9f..0d15bea6488175a5837d9f185dd464101247c7ad 100644 (file)
@@ -57,8 +57,6 @@ function action_data()
                json = "application/json"
        }
 
-       local filename = "data." .. mtype
-
        local args = { }
        local mtype = http.formvalue("type") or "json"
        local delim = http.formvalue("delim") or ","
@@ -94,7 +92,7 @@ function action_data()
        end
 
        http.prepare_content(types[mtype])
-       http.header("Content-Disposition", "attachment; filename=\"%s\"" % filename)
+       http.header("Content-Disposition", "attachment; filename=\"data.%s\"" % mtype)
        exec("/usr/sbin/nlbw", args, http.write)
 end