commit 6c83c78: [Minor] Deal with cte modifications

Vsevolod Stakhov vsevolod at highsecure.ru
Wed Feb 19 14:42:07 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-02-19 14:37:24 +0000
URL: https://github.com/rspamd/rspamd/commit/6c83c787baa12140eba6993760a7baf858c4b4c8 (HEAD -> master)

[Minor] Deal with cte modifications

---
 lualib/lua_mime.lua      | 3 +++
 lualib/rspamadm/mime.lua | 4 ++--
 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


More information about the Commits mailing list