From 8ba1e1ba9e4bd18fd7044714799b645569eb429c Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Mon, 20 Nov 2023 12:38:37 +0100 Subject: [PATCH] [Rspamd] workaround - remove "--\x0D\x0A" prefix from rewritten cts --- data/conf/rspamd/lua/rspamd.local.lua | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/data/conf/rspamd/lua/rspamd.local.lua b/data/conf/rspamd/lua/rspamd.local.lua index acc40559..c255ea8a 100644 --- a/data/conf/rspamd/lua/rspamd.local.lua +++ b/data/conf/rspamd/lua/rspamd.local.lua @@ -631,15 +631,19 @@ rspamd_config:register_symbol({ end local out_parts = {} for _,o in ipairs(out) do - if type(o) ~= 'table' then - out_parts[#out_parts + 1] = o - out_parts[#out_parts + 1] = newline_s - else - out_parts[#out_parts + 1] = o[1] - if o[2] then - out_parts[#out_parts + 1] = newline_s - end - end + if type(o) ~= 'table' then + out_parts[#out_parts + 1] = o + out_parts[#out_parts + 1] = newline_s + else + local removePrefix = "--\x0D\x0AContent-Type" + if string.lower(string.sub(tostring(o[1]), 1, string.len(removePrefix))) == string.lower(removePrefix) then + o[1] = string.sub(tostring(o[1]), string.len("--\x0D\x0A") + 1) + end + out_parts[#out_parts + 1] = o[1] + if o[2] then + out_parts[#out_parts + 1] = newline_s + end + end end task:set_message(out_parts) else