fix: escape string in script problem
All checks were successful
Autotools pipeline / build-amd64 (push) Successful in 50s
Autotools pipeline / build-arm64 (push) Successful in 48s
Autotools pipeline / build-arm (push) Successful in 47s

This commit is contained in:
DL
2026-04-08 13:04:38 +02:00
parent 3b8d7744b5
commit df2eb3d57d

View File

@@ -64,7 +64,7 @@ function loadscript(file, args)
if (s) then
if mtbegin then
if html ~= "" then
pro = pro .. "echo(\"" .. utils.escape(html) .. "\")\n"
pro = pro .. "echo(\"" .. utils.escape(html, true) .. "\")\n"
html = ""
end
local b, f = line:find("%?>%s*$")
@@ -89,7 +89,7 @@ function loadscript(file, args)
-- find the close
local x, y = tmp:find("%?>")
if x then
pro = pro .. "\"" .. utils.escape(html .. tmp:sub(0, b - 1):gsub("%%", "%%%%")) ..
pro = pro .. "\"" .. utils.escape(html .. tmp:sub(0, b - 1), true) ..
"\".."
pro = pro .. tmp:sub(f + 1, x - 1) .. ".."
html = ""
@@ -99,9 +99,9 @@ function loadscript(file, args)
error("Syntax error near line " .. i)
end
end
pro = pro .. "\"" .. utils.escape(tmp:gsub("%%", "%%%%")) .. "\")\n"
pro = pro .. "\"" .. utils.escape(tmp, true) .. "\")\n"
else
html = html .. ulib.trim(line, " "):gsub("%%", "%%%%") .. "\n"
html = html .. ulib.trim(line, " ") .. "\n"
end
else
if line ~= "" then
@@ -114,7 +114,7 @@ function loadscript(file, args)
end
f:close()
if (html ~= "") then
pro = pro .. "echo(\"" .. utils.escape(html) .. "\")\n"
pro = pro .. "echo(\"" .. utils.escape(html, true) .. "\")\n"
end
pro = pro .. "\nend \n return fn"
local r, e = load(pro)