From 914c661b58fc7e2dede1b9b4f83544b05232065c Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 24 Apr 2018 13:37:33 +0200 Subject: [PATCH] luci-base: ensure that file upload values have length Ensure that the (table) length of a file upload value has nonzero length by initializing the first table index with the file name. This fixes tests in the form x = luci.http.formvalue(...) if x and #x > 0 then ... end Fixes #1763. Signed-off-by: Jo-Philipp Wich --- modules/luci-base/luasrc/http.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/luci-base/luasrc/http.lua b/modules/luci-base/luasrc/http.lua index 56d0064825..be5577ee09 100644 --- a/modules/luci-base/luasrc/http.lua +++ b/modules/luci-base/luasrc/http.lua @@ -359,6 +359,7 @@ function mimedecode_message_body(src, msg, file_cb) then field.name = lhttp.header_attribute(buffer, "name") field.file = lhttp.header_attribute(buffer, "filename") + field[1] = field.file end if field.headers then -- 2.30.2