From: Vsevolod Stakhov Date: Tue, 18 Dec 2018 15:37:37 +0000 (+0000) Subject: [Minor] Rspamadm: Add some heuristic for missing CT X-Git-Tag: 1.9.0~398 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=597e2323758a22870f541817d4a3bcc05db42b05;p=thirdparty%2Frspamd.git [Minor] Rspamadm: Add some heuristic for missing CT --- diff --git a/lualib/rspamadm/mime.lua b/lualib/rspamadm/mime.lua index fa6cc1ee04..423a6910ae 100644 --- a/lualib/rspamadm/mime.lua +++ b/lualib/rspamadm/mime.lua @@ -711,7 +711,23 @@ local function modify_handler(opts) parsed_ct = ct end else - -- XXX: Write some content type based on magic? + local text_parts = task:get_text_parts() + if text_parts then + + if #text_parts == 1 then + need_rewrite_ct = true + parsed_ct = { + type = 'text', + subtype = 'plain' + } + elseif #text_parts > 1 then + -- XXX: in fact, it cannot be + parsed_ct = { + type = 'multipart', + subtype = 'mixed' + } + end + end end end