aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib/mail_handler/mail_handler_spec.rb
diff options
context:
space:
mode:
authorMark Longair <mhl@pobox.com>2013-12-02 16:11:31 +0000
committerMark Longair <mhl@pobox.com>2013-12-03 16:14:03 +0000
commit723d6c1d73176bf723b0c4726a150b1842bedf8e (patch)
tree6f6542dc99ca3736ba34102aab344655d73c1bd2 /spec/lib/mail_handler/mail_handler_spec.rb
parent0fe4865455786164c95766f514b4625e6061136f (diff)
Treat any document/pdf attachment as if it were application/pdf
This is a fix for issue #1232. Richard Taylor pointed out that some PDF attachments had the non-standard content-type document/pdf, and that these weren't being treated as PDFs. (Ganesh Sittampalam discovered that all of these PDFs were generated by a Lexmark X945e, according to the PDF metadata.) This commit adds an extra case to normalise_content_type to map document/pdf to application/pdf. In fact, since the upgrade of the Mail gem in ccebe3c3d6d4dc5f81 the behaviour when handling the non-standard content-type document/pdf was much better, but this commit also means that you get the right icon for the attachment, and can be cherry-picked onto older versions to fix #1232.
Diffstat (limited to 'spec/lib/mail_handler/mail_handler_spec.rb')
-rw-r--r--spec/lib/mail_handler/mail_handler_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/lib/mail_handler/mail_handler_spec.rb b/spec/lib/mail_handler/mail_handler_spec.rb
index bc027eaec..49a65dade 100644
--- a/spec/lib/mail_handler/mail_handler_spec.rb
+++ b/spec/lib/mail_handler/mail_handler_spec.rb
@@ -409,6 +409,12 @@ describe 'when getting attachment attributes' do
attributes[1][:body].length.should == 7769
end
+ it 'should treat a document/pdf attachment as application/pdf' do
+ mail = get_fixture_mail('document-pdf.email')
+ attributes = MailHandler.get_attachment_attributes(mail)
+ attributes[1][:content_type].should == "application/pdf"
+ end
+
it 'should produce a consistent set of url_part_numbers, content_types, within_rfc822_subjects
and filenames from an example mail with lots of attachments' do
mail = get_fixture_mail('many-attachments-date-header.email')