From 722d75360f5fb7572f19429f2bc896fa4665066d Mon Sep 17 00:00:00 2001 From: Annwan Date: Wed, 14 Aug 2024 15:46:02 +0200 Subject: [PATCH] [YQTemplate] Read all args in a table --- yqtemplate.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/yqtemplate.lua b/yqtemplate.lua index 018be51..950a24f 100644 --- a/yqtemplate.lua +++ b/yqtemplate.lua @@ -11,11 +11,15 @@ return { fcgi.print("Content-Type: text/html; charset=utf-8\r\n\r\n") local data = "" if fcgi.getenv("REQUEST_METHOD") == "POST" then - --- @type string local content_type = fcgi.getenv("CONTENT_TYPE") local boundary = content_type:match("; boundary=(.*)$") - -- local post_data = fcgi.post() + local post_data = fcgi.post() data = "Content type:" .. content_type .. "\n Boundary: "..boundary.."\n" + local args = {} + for w in string.gmatch(post_data, "(.-)"..boundary) do + args[#args+1] = w + end + data = table.concat(args, "\n\n") end fcgi.print(form{data = data}) end