aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/rspamadm/mime.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-12-18 15:37:37 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-12-18 15:37:37 +0000
commit597e2323758a22870f541817d4a3bcc05db42b05 (patch)
tree8532ce06825e582a6797af02eac51341ad082259 /lualib/rspamadm/mime.lua
parent57819446d5026c5ec7a6566ae4a34ad6a2fe74d7 (diff)
downloadrspamd-597e2323758a22870f541817d4a3bcc05db42b05.tar.gz
rspamd-597e2323758a22870f541817d4a3bcc05db42b05.zip
[Minor] Rspamadm: Add some heuristic for missing CT
Diffstat (limited to 'lualib/rspamadm/mime.lua')
-rw-r--r--lualib/rspamadm/mime.lua18
1 files changed, 17 insertions, 1 deletions
diff --git a/lualib/rspamadm/mime.lua b/lualib/rspamadm/mime.lua
index fa6cc1ee0..423a6910a 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