From: Vsevolod Stakhov Date: Wed, 21 Oct 2020 13:26:56 +0000 (+0100) Subject: [Minor] Lua_magic: Improve html detection heuristic X-Git-Tag: 2.7~214 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=63869b7d7bcbdc29b607e2c20cf97c89a8a724ae;p=thirdparty%2Frspamd.git [Minor] Lua_magic: Improve html detection heuristic --- diff --git a/lualib/lua_magic/heuristics.lua b/lualib/lua_magic/heuristics.lua index e623c09c13..6822abe1e3 100644 --- a/lualib/lua_magic/heuristics.lua +++ b/lualib/lua_magic/heuristics.lua @@ -435,10 +435,17 @@ exports.text_part_heuristic = function(part, log_obj, _) end end + -- Content type stuff if (mtype == 'text' or mtype == 'application') and (msubtype == 'html' or msubtype == 'xhtml+xml') then return 'html',21 end + -- Extension stuff + local fname = part:get_filename() + if fname and fname:match('html?$') then + return 'html',21 + end + return 'txt',40 end end