1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2025-12-16 03:15:59 +00:00

[RSPAMD] Add boundary if present when applying domain-wide footer

This commit is contained in:
FreddleSpl0it
2025-09-09 10:52:19 +02:00
parent 8446abd484
commit 8d7235b535

View File

@@ -624,15 +624,19 @@ rspamd_config:register_symbol({
local function rewrite_ct_cb(name, hdr) local function rewrite_ct_cb(name, hdr)
if rewrite.need_rewrite_ct then if rewrite.need_rewrite_ct then
if name:lower() == 'content-type' then if name:lower() == 'content-type' then
local nct = string.format('%s: %s/%s; charset=utf-8', -- include boundary if present
'Content-Type', rewrite.new_ct.type, rewrite.new_ct.subtype) local boundary_part = rewrite.new_ct.boundary and
string.format('; boundary="%s"', rewrite.new_ct.boundary) or ''
local nct = string.format('%s: %s/%s; charset=utf-8%s',
'Content-Type', rewrite.new_ct.type, rewrite.new_ct.subtype, boundary_part)
out[#out + 1] = nct out[#out + 1] = nct
-- update Content-Type header -- update Content-Type header (include boundary if present)
task:set_milter_reply({ task:set_milter_reply({
remove_headers = {['Content-Type'] = 0}, remove_headers = {['Content-Type'] = 0},
}) })
task:set_milter_reply({ task:set_milter_reply({
add_headers = {['Content-Type'] = string.format('%s/%s; charset=utf-8', rewrite.new_ct.type, rewrite.new_ct.subtype)} add_headers = {['Content-Type'] = string.format('%s/%s; charset=utf-8%s',
rewrite.new_ct.type, rewrite.new_ct.subtype, boundary_part)}
}) })
return return
elseif name:lower() == 'content-transfer-encoding' then elseif name:lower() == 'content-transfer-encoding' then