]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Feature] Use detected MIME types for attachments in structured formatter
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 14 Feb 2026 21:22:52 +0000 (21:22 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 14 Feb 2026 21:22:52 +0000 (21:22 +0000)
src/plugins/lua/metadata_exporter.lua

index 65356677d250b68ddcd2dd0d5bad8e3ef08772af..32a81a9c8c712d80d30c211270cefb42ddb0ef6c 100644 (file)
@@ -306,7 +306,11 @@ local formatters = {
           content = content or '',
         })
       elseif part:is_attachment() then
-        local mime_type, mime_subtype = part:get_type()
+        -- Prefer detected type over announced type if available
+        local mime_type, mime_subtype = part:get_detected_type()
+        if not mime_type then
+          mime_type, mime_subtype = part:get_type()
+        end
         local content = part:get_content()
         table.insert(attachments, {
           filename = part:get_filename() or '',