diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-10-21 14:26:56 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-10-21 14:26:56 +0100 |
commit | 63869b7d7bcbdc29b607e2c20cf97c89a8a724ae (patch) | |
tree | 32328ffb5ba8c32a83dd4103fb6b4739e9c7aeb9 /lualib/lua_magic/heuristics.lua | |
parent | 9e9a41aedd0ee6ac6744a1ed291f7e452e089b46 (diff) | |
download | rspamd-63869b7d7bcbdc29b607e2c20cf97c89a8a724ae.tar.gz rspamd-63869b7d7bcbdc29b607e2c20cf97c89a8a724ae.zip |
[Minor] Lua_magic: Improve html detection heuristic
Diffstat (limited to 'lualib/lua_magic/heuristics.lua')
-rw-r--r-- | lualib/lua_magic/heuristics.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lualib/lua_magic/heuristics.lua b/lualib/lua_magic/heuristics.lua index e623c09c1..6822abe1e 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 |