From c551d3d8dd756816b550dadb9e226c2d3ea6f334 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 27 Jan 2022 21:14:22 +0100 Subject: util.format: Skip control code escaping when doing full serialization Fixes that a multi-line string ended up "like\ \9this" instead of "like\nthis" as can be demonstrated by somehow initiating a connection to a HTTP server. --- util/format.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util') diff --git a/util/format.lua b/util/format.lua index 1cd8d81b..533f3a82 100644 --- a/util/format.lua +++ b/util/format.lua @@ -108,7 +108,7 @@ local function format(formatstring, ...) if t == "string" and option ~= "p" then if not valid_utf8(arg) then option = "q"; - else + elseif option ~= "q" then -- gets fully escaped in the next block args[i] = arg:gsub("[%z\1-\8\11-\31\127]", control_symbols):gsub("\n\t?", "\n\t"); return spec; end -- cgit v1.2.3