From af66bcae904101b46244bd16da1b9ed6533dccaf Mon Sep 17 00:00:00 2001 From: Alexander Moisseev Date: Sat, 20 Feb 2016 10:34:34 +0300 Subject: Don't trigger HTML_SHORT_LINK_IMG on small images It's common for legitimate emails to have small image links (buttons, social networks junk e.t.c.) --- rules/html.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rules/html.lua b/rules/html.lua index 0f26d1421..47ff528e8 100644 --- a/rules/html.lua +++ b/rules/html.lua @@ -38,7 +38,10 @@ local function check_html_image(task, min, max) local parent = tag:get_parent() if parent then if parent:get_type() == 'a' then - return true + -- do not trigger on small and unknown size images + if i['height'] + i['width'] >= 210 then + return true + end end end end -- cgit v1.2.3 From 029d2f4fa1a99728235d5abd87dca885172f2a72 Mon Sep 17 00:00:00 2001 From: Alexander Moisseev Date: Sat, 20 Feb 2016 10:45:22 +0300 Subject: Don't trigger R_EMPTY_IMAGE on image links as they covered with `HTML_SHORT_LINK_IMG_1` rule. It should be safe for legitimate emails with images attached since `R_EMPTY_IMAGE` and `HTML_SHORT_LINK_IMG_1` won't be triggered at the same time any more. --- rules/html.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/html.lua b/rules/html.lua index 47ff528e8..416ea8c74 100644 --- a/rules/html.lua +++ b/rules/html.lua @@ -97,7 +97,7 @@ rspamd_config.R_EMPTY_IMAGE = { if tag then local parent = tag:get_parent() if parent then - if parent:get_type() == 'a' then + if parent:get_type() ~= 'a' then return true end end -- cgit v1.2.3