commit f722832: [Minor] Do not autodetect html parts as text parts

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Jul 16 15:21:11 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-07-16 16:14:22 +0100
URL: https://github.com/rspamd/rspamd/commit/f722832e3aba64438a7ca132a56db00bb182e2f6 (HEAD -> master)

[Minor] Do not autodetect html parts as text parts

---
 lualib/lua_magic/heuristics.lua | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lualib/lua_magic/heuristics.lua b/lualib/lua_magic/heuristics.lua
index 82c2fa4bd..8c63cce72 100644
--- a/lualib/lua_magic/heuristics.lua
+++ b/lualib/lua_magic/heuristics.lua
@@ -393,6 +393,7 @@ exports.text_part_heuristic = function(part, log_obj, _)
   end
 
   local content = part:get_content()
+  local mtype,msubtype = part:get_type()
   local clen = #content
   local is_text
 
@@ -433,6 +434,10 @@ exports.text_part_heuristic = function(part, log_obj, _)
         end
       end
 
+      if mtype == 'text' and (msubtype == 'html' or msubtype == 'htm') then
+        return 'html',21
+      end
+
       return 'txt',40
     end
   end


More information about the Commits mailing list