From fd24c961ae6ed53edc14e34991a8e5f603307596 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 8 Aug 2016 15:56:29 +0100 Subject: [PATCH] [Fix] Further fixes for white on white rule --- conf/metrics.conf | 2 +- rules/html.lua | 2 +- src/libserver/html.c | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/conf/metrics.conf b/conf/metrics.conf index 8fee470cc..1af29d420 100644 --- a/conf/metrics.conf +++ b/conf/metrics.conf @@ -361,7 +361,7 @@ metric { group "body" { symbol "R_WHITE_ON_WHITE" { - weight = 5.5; + weight = 4.0; description = "White color on white background in HTML messages"; } symbol "HTML_SHORT_LINK_IMG_1" { diff --git a/rules/html.lua b/rules/html.lua index 2a807d07e..e1fdb6b73 100644 --- a/rules/html.lua +++ b/rules/html.lua @@ -175,7 +175,7 @@ rspamd_config.R_WHITE_ON_WHITE = { local arg for _,p in ipairs(tp) do -- iterate over text parts array using `ipairs` - if p:is_html() then -- if the current part is html part + if p:is_html() and p:get_html() then -- if the current part is html part normal_len = p:get_length() local hc = p:get_html() -- we get HTML context diff --git a/src/libserver/html.c b/src/libserver/html.c index 3fb17d4e6..b121006bb 100644 --- a/src/libserver/html.c +++ b/src/libserver/html.c @@ -1545,8 +1545,10 @@ rspamd_html_process_style (rspamd_mempool_t *pool, struct html_block *bl, rspamd_html_process_color (c, p - c, &bl->font_color); msg_debug_pool ("got color: %xd", bl->font_color.d.val); } - if (klen == 16 && g_ascii_strncasecmp (key, - "background-color", 16) == 0) { + else if ((klen == 16 && g_ascii_strncasecmp (key, + "background-color", 16) == 0) || + (klen == 10 && g_ascii_strncasecmp (key, + "background", 10) == 0)) { rspamd_html_process_color (c, p - c, &bl->background_color); msg_debug_pool ("got bgcolor: %xd", bl->background_color.d.val); -- 2.39.5