]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Deal with cte modifications
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 19 Feb 2020 14:37:24 +0000 (14:37 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 19 Feb 2020 14:37:24 +0000 (14:37 +0000)
lualib/lua_mime.lua
lualib/rspamadm/mime.lua

index 9b530a996eeeb9fd17ba9ab3b0fa1dc92813916f..b839933b051cd53b8fc2fd78d2859b84c6bfe835 100644 (file)
@@ -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 '')
index ae29f0eb1d4453f659003bd88236beaeae4abb99..8ef82f1c072d60d1877e7dbc0d3382354883b5a1 100644 (file)
@@ -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