1
0
مراية لـ https://github.com/postalserver/postal.git تم المزامنة 2025-11-30 21:32:30 +00:00

fix: update raw headers after changing messages to during parsing

Previously, headers were not updated but the mail gem parsing may decide
to change the transfer encoding. If it does this, the body is updated to
the new format but the header is not, this results in a mismatch when the
message it sent onwards and the client being unable render the message.

The specific situation identified was changing an HTML-only e-mail from
quoted-printable to 7bit.

closes #2816
هذا الالتزام موجود في:
Adam Cooke
2024-02-23 22:16:36 +00:00
الأصل 559b08ddd3
التزام 2834e2c379
2 ملفات معدلة مع 8 إضافات و2 حذوفات

عرض الملف

@@ -535,7 +535,9 @@ module Postal
if parse_result.actioned? if parse_result.actioned?
#  Somethign was changed, update the raw message #  Somethign was changed, update the raw message
@database.update(raw_table, { data: parse_result.new_body }, where: { id: raw_body_id }) @database.update(raw_table, { data: parse_result.new_body }, where: { id: raw_body_id })
@database.update(raw_table, { data: parse_result.new_headers }, where: { id: raw_headers_id })
@raw = parse_result.new_body @raw = parse_result.new_body
@raw_headers = parse_result.new_headers
@raw_message = nil @raw_message = nil
end end
update("parsed" => 1, "tracked_links" => parse_result.tracked_links, "tracked_images" => parse_result.tracked_images) update("parsed" => 1, "tracked_links" => parse_result.tracked_links, "tracked_images" => parse_result.tracked_images)

عرض الملف

@@ -14,7 +14,7 @@ module Postal
return unless @domain return unless @domain
@parsed_output = generate @parsed_output = generate.split("\r\n\r\n", 2)
end end
attr_reader :tracked_links attr_reader :tracked_links
@@ -25,7 +25,11 @@ module Postal
end end
def new_body def new_body
@parsed_output.split("\r\n\r\n", 2)[1] @parsed_output[1]
end
def new_headers
@parsed_output[0]
end end
private private