]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Improve lua_magic HTML content type check 3477/head
authorAnton Yuzhaninov <citrin+git@citrin.ru>
Wed, 19 Aug 2020 16:39:59 +0000 (17:39 +0100)
committerAnton Yuzhaninov <citrin+git@citrin.ru>
Thu, 20 Aug 2020 09:05:51 +0000 (10:05 +0100)
Types which are used for html (xhtml) attachments:
text/html
application/html
application/xhtml+xml

Type which cannot be found in the wild:
text/htm

lualib/lua_magic/heuristics.lua

index 8c63cce72dafc0bbbc92e5325e65f4ca2d3e7ea6..d36b5633fea9ffe557b0f29395a20b91d1511bc0 100644 (file)
@@ -434,7 +434,7 @@ exports.text_part_heuristic = function(part, log_obj, _)
         end
       end
 
-      if mtype == 'text' and (msubtype == 'html' or msubtype == 'htm') then
+      if (mtype == 'text' or mtype == 'application') and (msubtype == 'html' or msubtype == 'xhtml+xml') then
         return 'html',21
       end
 
@@ -458,4 +458,4 @@ exports.pdf_format_heuristic = function(input, log_obj, pos, part)
   return 'pdf',weight
 end
 
-return exports
\ No newline at end of file
+return exports