mirror of
https://github.com/postalserver/postal.git
synced 2026-10-19 18:56:05 +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
This commit is contained in:
@@ -535,7 +535,9 @@ module Postal
|
||||
if parse_result.actioned?
|
||||
# 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_headers }, where: { id: raw_headers_id })
|
||||
@raw = parse_result.new_body
|
||||
@raw_headers = parse_result.new_headers
|
||||
@raw_message = nil
|
||||
end
|
||||
update("parsed" => 1, "tracked_links" => parse_result.tracked_links, "tracked_images" => parse_result.tracked_images)
|
||||
|
||||
@@ -14,7 +14,7 @@ module Postal
|
||||
|
||||
return unless @domain
|
||||
|
||||
@parsed_output = generate
|
||||
@parsed_output = generate.split("\r\n\r\n", 2)
|
||||
end
|
||||
|
||||
attr_reader :tracked_links
|
||||
@@ -25,7 +25,11 @@ module Postal
|
||||
end
|
||||
|
||||
def new_body
|
||||
@parsed_output.split("\r\n\r\n", 2)[1]
|
||||
@parsed_output[1]
|
||||
end
|
||||
|
||||
def new_headers
|
||||
@parsed_output[0]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user