diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-07-04 14:56:47 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-07-04 15:54:39 +0100 |
commit | 5d3677f48bf7b0493bab5cae6f7928f9a878f320 (patch) | |
tree | d3c028311c7e65079ee819510790bba24d29f45d /lualib/rspamadm | |
parent | 2bf955712401df23751afdb5196b42ffa5fd6694 (diff) | |
download | rspamd-5d3677f48bf7b0493bab5cae6f7928f9a878f320.tar.gz rspamd-5d3677f48bf7b0493bab5cae6f7928f9a878f320.zip |
[Minor] Use proper hashing when getting texts fuzzy hash
Diffstat (limited to 'lualib/rspamadm')
-rw-r--r-- | lualib/rspamadm/mime.lua | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/lualib/rspamadm/mime.lua b/lualib/rspamadm/mime.lua index f31fe29f1..f41529646 100644 --- a/lualib/rspamadm/mime.lua +++ b/lualib/rspamadm/mime.lua @@ -325,12 +325,22 @@ local function stat_handler(opts) end for _,part in ipairs(parts) do if not part:is_multipart() then - table.insert(out_elts[fname], { - digest = part:get_digest(), - file = part:get_filename(), - type = string.format('%s/%s', part:get_type()) - }) - + local text = part:get_text() + + if text then + local digest,shingles = text:get_fuzzy_hashes(task:get_mempool()) + table.insert(out_elts[fname], { + digest = digest, + shingles = rspamd_logger.slog('%s', shingles), + type = string.format('%s/%s', part:get_type()) + }) + else + table.insert(out_elts[fname], { + digest = part:get_digest(), + file = part:get_filename(), + type = string.format('%s/%s', part:get_type()) + }) + end end end end |