]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Rspamadm: Add some heuristic for missing CT
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 18 Dec 2018 15:37:37 +0000 (15:37 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 18 Dec 2018 15:37:37 +0000 (15:37 +0000)
lualib/rspamadm/mime.lua

index fa6cc1ee0482867a05169d6ca4774ad3bb0f0413..423a6910aec7b088cc281bb68d37959e785bdfc6 100644 (file)
@@ -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