]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Empty envelopes should not be emitted as arrays (json+messagepack) when populat...
authorJason Stephenson <j.stephenson@live.co.uk>
Fri, 15 Jul 2022 15:10:45 +0000 (16:10 +0100)
committerJason Stephenson <j.stephenson@live.co.uk>
Fri, 15 Jul 2022 15:10:45 +0000 (16:10 +0100)
lualib/lua_mime.lua

index 4f84509645b9dcf64c84179b8c073c211ceb7b7e..575e9152c002e20483a78b21ac98deb341ee375f 100644 (file)
@@ -596,7 +596,8 @@ exports.message_to_ucl = function(task, stringify_content)
 
     return nil
   end
-  -- Envelope (smtp) information form email
+
+  -- Envelope (smtp) information from email (nil if empty)
   result.envelope = {
     from_smtp = (task:get_from('smtp') or E)[1],
     recipients_smtp = task:get_recipients('smtp'),
@@ -605,6 +606,9 @@ exports.message_to_ucl = function(task, stringify_content)
     client_ip = maybe_stringify_ip(task:get_client_ip()),
     from_ip = maybe_stringify_ip(task:get_from_ip()),
   }
+  if not next(result.envelope) then
+    result.envelope = nil
+  end
 
   local parts = task:get_parts() or E
   result.parts = {}