]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Lua_magic: Improve html detection heuristic
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 21 Oct 2020 13:26:56 +0000 (14:26 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 21 Oct 2020 13:26:56 +0000 (14:26 +0100)
lualib/lua_magic/heuristics.lua

index e623c09c138661ed5aa81c7d848767593cbbb738..6822abe1e389aed5bc2116e2477347def4cc05b5 100644 (file)
@@ -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