end
end
- if is_multipart then
- out[#out + 1] = string.format('Content-Type: %s; charset=utf-8%s'..
- 'Content-Transfer-Encoding: %s',
- ct, newline_s, cte)
- out[#out + 1] = ''
- else
- state.new_cte = cte
- end
-
local content = tp:get_content('raw_utf') or rspamd_text.fromstring('')
local match_pos = mp:match(content, true)
return
end
+ if is_multipart then
+ out[#out + 1] = {string.format('Content-Type: %s; charset=utf-8%s'..
+ 'Content-Transfer-Encoding: %s',
+ ct, newline_s, cte), true}
+ out[#out + 1] = {'', true}
+ else
+ state.new_cte = cte
+ end
+
state.has_matches = true
-- now sort flattened by start of match and eliminate all overlaps
table.sort(matches_flattened, function(m1, m2) return m1[1][1] < m2[1][1] end)
end
-- Final stuff
- out[#out + 1] = {encode_func(rspamd_text.fromtable(fragments)), true}
- out[#out + 1] = ''
+ out[#out + 1] = {encode_func(rspamd_text.fromtable(fragments)), false}
+ out[#out + 1] = {'', true}
else
-- No matches
out[#out + 1] = {part:get_raw_headers(), true}
local boundary = part:get_boundary()
if part:is_multipart() then
if cur_boundary then
- out[#out + 1] = string.format('--%s',
- boundaries[#boundaries])
+ out[#out + 1] = {string.format('--%s',
+ boundaries[#boundaries]), true}
end
boundaries[#boundaries + 1] = boundary or '--XXX'
if boundary then
if cur_boundary and boundary ~= cur_boundary then
-- Need to close boundary
- out[#out + 1] = string.format('--%s--%s',
- boundaries[#boundaries], newline_s)
+ out[#out + 1] = {string.format('--%s--',
+ boundaries[#boundaries]), true}
table.remove(boundaries)
cur_boundary = nil
end
- out[#out + 1] = string.format('--%s',
- boundary)
+ out[#out + 1] = {string.format('--%s',
+ boundary), true}
end
out[#out + 1] = {part:get_raw_headers(), true}
if boundary then
if cur_boundary and boundary ~= cur_boundary then
-- Need to close boundary
- out[#out + 1] = string.format('--%s--%s',
- boundaries[#boundaries], newline_s)
+ out[#out + 1] = {string.format('--%s--',
+ boundaries[#boundaries]), true}
table.remove(boundaries)
cur_boundary = boundary
end
- out[#out + 1] = string.format('--%s',
- boundary)
+ out[#out + 1] = {string.format('--%s',
+ boundary), true}
end
if not skip_replacement then
-- Close remaining
local b = table.remove(boundaries)
while b do
- out[#out + 1] = string.format('--%s--', b)
+ out[#out + 1] = {string.format('--%s--', b), true}
if #boundaries > 0 then
- out[#out + 1] = ''
+ out[#out + 1] = {'', true}
end
b = table.remove(boundaries)
end