From bb58fb5440a4bc4dc02abbf7f61faa9bf01f17b6 Mon Sep 17 00:00:00 2001 From: Carsten Rosenberg Date: Wed, 26 Sep 2018 14:31:47 +0200 Subject: [Minor] Antivirus - configureable mime_part scanning --- src/plugins/lua/antivirus.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/lua/antivirus.lua b/src/plugins/lua/antivirus.lua index 976e521f4..047035fc1 100644 --- a/src/plugins/lua/antivirus.lua +++ b/src/plugins/lua/antivirus.lua @@ -871,11 +871,17 @@ local function add_antivirus_rule(sym, opts) end return function(task) - if rule.attachments_only then + if rule.scan_mime_parts then local parts = task:get_parts() or {} for _,p in ipairs(parts) do - if not p:is_image() and not p:is_text() and not p:is_multipart() then + if ( + (p:is_image() and rule.scan_image_mime) + or (p:is_text() and rule.scan_text_mime) + or (p:is_multipart() and rule.scan_text_mime) + or (not p:is_image() and not p:is_text() and not p:is_multipart()) + ) then + local content = p:get_content() if content and #content > 0 then -- cgit v1.2.3