diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-08 10:54:26 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-08 10:54:26 +0000 |
commit | 6d87018738712b7d01120ad3584b5db225255ce8 (patch) | |
tree | b1262194708189ac58f8448ec7b20ed68d775146 /lualib/lua_fuzzy.lua | |
parent | 547fed8a0a304f22a77e7b80264ff86d04c5dce8 (diff) | |
download | rspamd-6d87018738712b7d01120ad3584b5db225255ce8.tar.gz rspamd-6d87018738712b7d01120ad3584b5db225255ce8.zip |
[Minor] Various fixes in lua_fuzzy library
Diffstat (limited to 'lualib/lua_fuzzy.lua')
-rw-r--r-- | lualib/lua_fuzzy.lua | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lualib/lua_fuzzy.lua b/lualib/lua_fuzzy.lua index afc46926a..178d06400 100644 --- a/lualib/lua_fuzzy.lua +++ b/lualib/lua_fuzzy.lua @@ -126,13 +126,14 @@ local function check_length(task, part, rule) local adjusted_bytes = bytes if part:is_text() then + bytes = part:get_text():get_length() if rule.text_multiplier then adjusted_bytes = bytes * rule.text_multiplier end end if rule.min_bytes > adjusted_bytes then - lua_util.debugm(N, task, 'skip part of length %s (%s adjusted)' .. + lua_util.debugm(N, task, 'skip part of length %s (%s adjusted) ' .. 'as it has less than %s bytes', bytes, adjusted_bytes, rule.min_bytes) length_ok = false @@ -244,11 +245,11 @@ local function mime_types_check(task, part, rule) lua_util.debugm(N, task, 'check binary part %s: %s', id, ct) -- For bad mime mime parts we implicitly enable fuzzy check - local mime_trace = task:get_symbol('MIME_TRACE') + local mime_trace = (task:get_symbol('MIME_TRACE') or {})[1] local opts = {} if mime_trace then - opts = mime_trace.options + opts = mime_trace.options or opts end opts = fun.tomap(fun.map(function(opt) local elts = lua_util.str_split(opt, ':') |