From: Vsevolod Stakhov Date: Thu, 3 Dec 2020 11:51:03 +0000 (+0000) Subject: [Minor] Lua_magic: Use larger span to look for text patterns X-Git-Tag: 2.7~91 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2aaf02a82cf2eebcccbeb470ec0a8d2f1999815a;p=rspamd.git [Minor] Lua_magic: Use larger span to look for text patterns --- diff --git a/lualib/lua_magic/heuristics.lua b/lualib/lua_magic/heuristics.lua index a0efdf50f..d9a7702a4 100644 --- a/lualib/lua_magic/heuristics.lua +++ b/lualib/lua_magic/heuristics.lua @@ -408,7 +408,7 @@ exports.text_part_heuristic = function(part, log_obj, _) if is_text then -- Try patterns - local span_len = math.min(160, clen) + local span_len = math.min(4096, clen) local start_span = content:span(1, span_len) local matches = txt_trie:match(start_span) local res = {} @@ -418,8 +418,8 @@ exports.text_part_heuristic = function(part, log_obj, _) local ext,weight = txt_patterns_indexes[n][1], txt_patterns_indexes[n][2][2] if ext then res[ext] = (res[ext] or 0) + weight * #positions - lua_util.debugm(N, log_obj, "found txt pattern for %s: %s, total: %s", - ext, weight * #positions, res[ext]) + lua_util.debugm(N, log_obj, "found txt pattern for %s: %s, total: %s; %s/%s announced", + ext, weight * #positions, res[ext], mtype, msubtype) end end