diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-07-15 22:28:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-15 22:28:20 +0100 |
commit | f8f9f3637976beb2368572d56994235fd39bf55c (patch) | |
tree | f804b07a43ff90101c8e47fe9fdc0859d7a064b7 | |
parent | ca32640e2372f97314dc65e9b40af718588753d6 (diff) | |
parent | 815256cc7d434c31b08f82d206c3b1a2025d1be6 (diff) | |
download | rspamd-f8f9f3637976beb2368572d56994235fd39bf55c.tar.gz rspamd-f8f9f3637976beb2368572d56994235fd39bf55c.zip |
Merge pull request #4216 from JasonStephenson/fix_empty_objects_are_arrays
[Fix] Empty envelopes should not be emitted as arrays, drop from schema instead
-rw-r--r-- | lualib/lua_mime.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lualib/lua_mime.lua b/lualib/lua_mime.lua index 4f8450964..02329badd 100644 --- a/lualib/lua_mime.lua +++ b/lualib/lua_mime.lua @@ -21,6 +21,7 @@ limitations under the License. local rspamd_util = require "rspamd_util" local rspamd_text = require "rspamd_text" +local ucl = require "ucl" local exports = {} @@ -596,7 +597,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 +607,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 = ucl.null + end local parts = task:get_parts() or E result.parts = {} |