commit d2ca787: [Rules] Improve zero font rule

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Sep 7 14:07:05 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-09-07 15:00:58 +0100
URL: https://github.com/rspamd/rspamd/commit/d2ca78731396d34148d3b2ab1d0503d07621557b (HEAD -> master)

[Rules] Improve zero font rule

---
 rules/html.lua | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rules/html.lua b/rules/html.lua
index 58fabfd7a..6427a325a 100644
--- a/rules/html.lua
+++ b/rules/html.lua
@@ -198,11 +198,11 @@ local vis_check_id = rspamd_config:register_symbol{
         hc:foreach_tag({'font', 'span', 'div', 'p', 'td'}, function(tag, clen, is_leaf)
           local bl = tag:get_style()
           if bl then
-            if not bl.visible and is_leaf then
+            if not bl.visible and clen > 0 and is_leaf then
               invisible_blocks = invisible_blocks + 1
             end
 
-            if (bl.font_size or 12) == 0 and is_leaf then
+            if (bl.font_size or 12) == 0 and clen > 0 and is_leaf then
               zero_size_blocks = zero_size_blocks + 1
             end
 


More information about the Commits mailing list