summaryrefslogtreecommitdiffstats
path: root/rules
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2017-07-10 11:34:23 +0200
committerAndrew Lewis <nerf@judo.za.org>2017-07-10 11:34:23 +0200
commit76a60e836eadbfc43021840b5c9e3b0cac6a7a52 (patch)
treedf553b29d957200de3cb38bd5b12746def90790b /rules
parent74dfbe19122c902733405cc158368a967aa66a4f (diff)
downloadrspamd-76a60e836eadbfc43021840b5c9e3b0cac6a7a52.tar.gz
rspamd-76a60e836eadbfc43021840b5c9e3b0cac6a7a52.zip
[Minor] WHITE_ON_WHITE: Use per-part transparency length
Diffstat (limited to 'rules')
-rw-r--r--rules/html.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/rules/html.lua b/rules/html.lua
index d240c836a..7c88928eb 100644
--- a/rules/html.lua
+++ b/rules/html.lua
@@ -174,13 +174,13 @@ rspamd_config.R_WHITE_ON_WHITE = {
local ret = false
local diff = 0.0
local normal_len = 0
- local transp_len = 0
local transp_rate = 0
local arg
for _,p in ipairs(tp) do -- iterate over text parts array using `ipairs`
if p:is_html() and p:get_html() then -- if the current part is html part
normal_len = p:get_length()
+ local transp_len = 0
local hc = p:get_html() -- we get HTML context
hc:foreach_tag({'font', 'span', 'div', 'p'}, function(tag)
@@ -198,7 +198,7 @@ rspamd_config.R_WHITE_ON_WHITE = {
if diff < 0.1 then
ret = true
- transp_len = (transp_len + tag:get_content_length()) *
+ transp_len = (tag:get_content_length()) *
(0.1 - diff) * 5.0
normal_len = normal_len - tag:get_content_length()
local tr = transp_len / (normal_len + transp_len)