commit 12e0300: [Minor] Lua_magic: Really add an exclusion...

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Apr 22 13:14:06 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-04-22 14:13:28 +0100
URL: https://github.com/rspamd/rspamd/commit/12e030093062ff6fbbb31f601d2f690337a9941b (HEAD -> master)

[Minor] Lua_magic: Really add an exclusion...

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

diff --git a/lualib/lua_magic/heuristics.lua b/lualib/lua_magic/heuristics.lua
index 5863897bc..aa8e9e819 100644
--- a/lualib/lua_magic/heuristics.lua
+++ b/lualib/lua_magic/heuristics.lua
@@ -403,7 +403,7 @@ exports.text_part_heuristic = function(part, log_obj, _)
       is_text = is_span_text(content)
     end
 
-    if is_text then
+    if is_text and mtype ~= 'message' then
       -- Try patterns
       local span_len = math.min(4096, clen)
       local start_span = content:span(1, span_len)
@@ -420,14 +420,14 @@ exports.text_part_heuristic = function(part, log_obj, _)
           end
         end
 
-        if res.html and res.html >= 40 then
+        if res.html and res.html >= 40  then
           -- HTML has priority over something like js...
           return 'html', res.html
         end
 
         local ext, weight = process_top_detected(res)
 
-        if weight and weight >= 40 and mtype ~= 'message' then
+        if weight and weight >= 40 then
           return ext, weight
         end
       end


More information about the Commits mailing list