]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Antivirus: Improve parts selection
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 15 Dec 2021 15:20:19 +0000 (15:20 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 15 Dec 2021 15:20:19 +0000 (15:20 +0000)
lualib/lua_scanners/common.lua

index a92d923d05c97485010d6a80b8e3fab7c0136441..d052f45525383d075cc6f541068d9c76a8f0c4ac 100644 (file)
@@ -459,14 +459,15 @@ local function check_parts_match(task, rule)
     end
 
     if rule.scan_all_mime_parts ~= false then
+      local is_part_checkable = (p:is_attachment() and (not p:is_image() or rule.scan_image_mime))
       if detected_ext then
         -- We know what to scan!
         local magic = lua_magic_types[detected_ext] or {}
 
-        if p:is_attachment() or magic.av_check ~= false then
+        if magic.av_check ~= false or is_part_checkable then
           return true
         end
-      elseif p:is_attachment() then
+      elseif is_part_checkable then
         -- Just rely on attachment property
         return true
       end