Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
preserve content id header of signed parts
- should fix problems with inline images in signed html mails
  • Loading branch information
jkraemer committed Jul 30, 2020
1 parent 7a6180c commit 261addd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/mail/gpg/signed_part.rb
Expand Up @@ -23,6 +23,9 @@ def self.build(cleartext_mail)
if disposition = cleartext_mail.content_disposition
content_disposition disposition
end
if id = cleartext_mail.header['Content-ID']
content_id id
end

# brute force approach to avoid messed up line endings that break
# signatures with Mail 2.7
Expand Down
2 changes: 2 additions & 0 deletions test/message_test.rb
Expand Up @@ -92,6 +92,7 @@ class MessageTest < MailGpgTestCase
@attachment_data = "this is\n € not an image".force_encoding(Encoding::BINARY)
@mail.attachments['test.jpg'] = { mime_type: 'image/jpeg',
content: @attachment_data }
@mail.attachments['test.jpg'].header['Content-ID'] = '<image002.jpg@01D665C1.3F756500>'

@mail.deliver
@signed = Mail.new @mails.first.to_s
Expand All @@ -110,6 +111,7 @@ class MessageTest < MailGpgTestCase
assert attachment.attachment?
assert_equal "attachment; filename=test.jpg", attachment.content_disposition
assert_equal @attachment_data, attachment.body.to_s
assert_equal '<image002.jpg@01D665C1.3F756500>', attachment.header['Content-ID'].to_s
end

end
Expand Down

0 comments on commit 261addd

Please sign in to comment.