diff options
-rw-r--r-- | conf/lua/html.lua | 23 | ||||
-rw-r--r-- | conf/lua/rspamd.lua | 16 |
2 files changed, 23 insertions, 16 deletions
diff --git a/conf/lua/html.lua b/conf/lua/html.lua index bd7abd987..161bbe3b5 100644 --- a/conf/lua/html.lua +++ b/conf/lua/html.lua @@ -15,6 +15,7 @@ local reconf = config['regexp'] local rspamd_regexp = require "rspamd_regexp" +local rspamd_logger = require "rspamd_logger" -- Messages that have only HTML part reconf['MIME_HTML_ONLY'] = 'has_only_html_part()' @@ -50,4 +51,26 @@ rspamd_config.HTML_SHORT_LINK_IMG_2 = function(task) end rspamd_config.HTML_SHORT_LINK_IMG_3 = function(task) return check_html_image(task, 1536, 2048) +end +rspamd_config.R_EMPTY_IMAGE = function(task) + local tp = task:get_text_parts() + + for _,p in ipairs(tp) do + if p:is_html() then + local hc = p:get_html() + local lines = p:get_lines_count() + + if lines < 5 then + local images = hc:get_images() + + if images then + for _,i in ipairs(images) do + if i['height'] + i['width'] >= 400 then + return true + end + end + end + end + end + end end
\ No newline at end of file diff --git a/conf/lua/rspamd.lua b/conf/lua/rspamd.lua index bb1709c69..ce2edd2b3 100644 --- a/conf/lua/rspamd.lua +++ b/conf/lua/rspamd.lua @@ -62,22 +62,6 @@ rspamd_config.R_PARTS_DIFFER = function(task) return false end -rspamd_config.R_EMPTY_IMAGE = function (task) - parts = task:get_text_parts() - if parts then - for _,part in ipairs(parts) do - if part:is_empty() then - images = task:get_images() - if images then - return true - end - return false - end - end - end - return false -end - -- Date issues rspamd_config.MISSING_DATE = function(task) if rspamd_config:get_api_version() >= 5 then |