aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_mime.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-12-09 11:00:14 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-12-09 11:00:14 +0000
commit510b61f82bae20b9d8c2b61b51a35d9579c2d347 (patch)
tree80679bb095a1dd446aa94bf3772d7182ec12527f /lualib/lua_mime.lua
parente8841063f78a78db360d4bea1ce7e9ce6dc54371 (diff)
downloadrspamd-510b61f82bae20b9d8c2b61b51a35d9579c2d347.tar.gz
rspamd-510b61f82bae20b9d8c2b61b51a35d9579c2d347.zip
[Fix] Output service parts as well
Diffstat (limited to 'lualib/lua_mime.lua')
-rw-r--r--lualib/lua_mime.lua20
1 files changed, 16 insertions, 4 deletions
diff --git a/lualib/lua_mime.lua b/lualib/lua_mime.lua
index 968d38c0a..1646b892c 100644
--- a/lualib/lua_mime.lua
+++ b/lualib/lua_mime.lua
@@ -609,18 +609,30 @@ exports.message_to_ucl = function(task, stringify_content)
local parts = task:get_parts() or E
result.parts = {}
for _,part in ipairs(parts) do
- local l = part:get_length()
- if l > 0 then
+ if not part:is_multipart() and not part:is_message() then
local p = {
- size = l,
+ size = part:get_length(),
type = string.format('%s/%s', part:get_type()),
detected_type = string.format('%s/%s', part:get_detected_type()),
filename = part:get_filename(),
content = maybe_stringify_f(part:get_content()),
headers = part:get_headers(true) or E,
- boundary = part:get_enclosing_boundary()
+ boundary = part:get_enclosing_boundary(),
}
table.insert(result.parts, p)
+ else
+ -- Service part: multipart container or message/rfc822
+ local p = {
+ type = string.format('%s/%s', part:get_type()),
+ headers = part:get_headers(true) or E,
+ boundary = part:get_enclosing_boundary(),
+ }
+
+ if part:is_multipart() then
+ p.multipart_boundary = part:get_boundary()
+ end
+
+ table.insert(result.parts, p)
end
end