aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-02-19 14:37:24 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-02-19 14:37:24 +0000
commit6c83c787baa12140eba6993760a7baf858c4b4c8 (patch)
treec278267df9c2e0fd015742d61a8bd97b3433515c
parent6b9f798d6a0be70e5e7c42f49bfccef67c7f7e54 (diff)
downloadrspamd-6c83c787baa12140eba6993760a7baf858c4b4c8.tar.gz
rspamd-6c83c787baa12140eba6993760a7baf858c4b4c8.zip
[Minor] Deal with cte modifications
-rw-r--r--lualib/lua_mime.lua3
-rw-r--r--lualib/rspamadm/mime.lua4
2 files changed, 5 insertions, 2 deletions
diff --git a/lualib/lua_mime.lua b/lualib/lua_mime.lua
index 9b530a996..b839933b0 100644
--- a/lualib/lua_mime.lua
+++ b/lualib/lua_mime.lua
@@ -44,6 +44,7 @@ end
-- * out: new content (body only)
-- * need_rewrite_ct: boolean field that means if we must rewrite content type
-- * new_ct: new content type (type => string, subtype => string)
+-- * new_cte: new content-transfer encoding (string)
--]]
exports.add_text_footer = function(task, html_footer, text_footer)
local newline_s = newline(task)
@@ -84,6 +85,8 @@ exports.add_text_footer = function(task, html_footer, text_footer)
'Content-Transfer-Encoding: %s',
ct, newline_s, cte)
out[#out + 1] = ''
+ else
+ res.new_cte = cte
end
local content = tostring(tp:get_content('raw_utf') or '')
diff --git a/lualib/rspamadm/mime.lua b/lualib/rspamadm/mime.lua
index ae29f0eb1..8ef82f1c0 100644
--- a/lualib/rspamadm/mime.lua
+++ b/lualib/rspamadm/mime.lua
@@ -690,7 +690,7 @@ local function modify_handler(opts)
return
elseif name:lower() == 'content-transfer-encoding' then
out[#out + 1] = string.format('%s: %s',
- 'Content-Transfer-Encoding', 'quoted-printable')
+ 'Content-Transfer-Encoding', rewrite.new_cte or 'quoted-printable')
seen_cte = true
return
end
@@ -712,7 +712,7 @@ local function modify_handler(opts)
if not seen_cte and rewrite.need_rewrite_ct then
out[#out + 1] = string.format('%s: %s',
- 'Content-Transfer-Encoding', 'quoted-printable')
+ 'Content-Transfer-Encoding', rewrite.new_cte or 'quoted-printable')
end
-- End of headers