aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAnton Yuzhaninov <citrin+git@citrin.ru>2020-08-18 18:45:30 +0100
committerAnton Yuzhaninov <citrin+git@citrin.ru>2020-08-18 18:45:30 +0100
commit11cf19b02cfdcf3cafd2cf4bf8becb477e98261b (patch)
treebf999cf35c6100d8dc5d8dc15ba3cd12d5644cfb /src/plugins
parent5098f10c3d713e925bc27053baf1e66e71baea50 (diff)
downloadrspamd-11cf19b02cfdcf3cafd2cf4bf8becb477e98261b.tar.gz
rspamd-11cf19b02cfdcf3cafd2cf4bf8becb477e98261b.zip
[Minor] Save into ClickHouse unnamed attaches
Most MUA allow to save attachments (parts with Content-Disposition: attachment) even if don't have a name. Keep name field empty and save other information about such attachments to ClickHouse: Content-Type, size, digest. Modify attachments selector as well to return hashes of unnamed attachments.
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/clickhouse.lua8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/plugins/lua/clickhouse.lua b/src/plugins/lua/clickhouse.lua
index 734832d57..487997ddd 100644
--- a/src/plugins/lua/clickhouse.lua
+++ b/src/plugins/lua/clickhouse.lua
@@ -726,11 +726,9 @@ local function clickhouse_collect(task)
local attachments_ctypes = {}
local attachments_lengths = {}
local attachments_digests = {}
- for _,part in ipairs(task:get_parts()) do
- local fname = part:get_filename()
-
- if fname then
- table.insert(attachments_fnames, fname)
+ for _, part in ipairs(task:get_parts()) do
+ if part:is_attachment() then
+ table.insert(attachments_fnames, part:get_filename() or '')
local mime_type, mime_subtype = part:get_type()
table.insert(attachments_ctypes, string.format("%s/%s", mime_type, mime_subtype))
table.insert(attachments_lengths, part:get_length())