aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib/mail_handler/mail_handler_spec.rb
diff options
context:
space:
mode:
authorMark Longair <mhl@pobox.com>2013-05-17 11:48:14 +0100
committerMark Longair <mhl@pobox.com>2013-05-17 11:48:14 +0100
commit46e7df935929793fafb6069fbd272f5a35752e89 (patch)
treec5fd6bb8de681655bf68612088185c6585f173eb /spec/lib/mail_handler/mail_handler_spec.rb
parentac2d5ed7f249fe5bef5601b4a60141fa79095558 (diff)
Cope with emails with a missing final MIME boundary
The Mail gem deals with multipart messages that look as if they should have 1 part but are missing the final MIME boundary, by make the parts list empty and setting part.body to the text of the email. Rather than throwing an exception in this case, we just pretend that part is text/plain and return it, so that the page doesn't error and we still have a chance of some useful text being displayed. Note that we haven't investigated yet the case of emails that have more than one start boundary, but no final boundary. Fixes #921
Diffstat (limited to 'spec/lib/mail_handler/mail_handler_spec.rb')
-rw-r--r--spec/lib/mail_handler/mail_handler_spec.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/spec/lib/mail_handler/mail_handler_spec.rb b/spec/lib/mail_handler/mail_handler_spec.rb
index c49e2ea07..d4f5737bb 100644
--- a/spec/lib/mail_handler/mail_handler_spec.rb
+++ b/spec/lib/mail_handler/mail_handler_spec.rb
@@ -352,14 +352,12 @@ describe 'when getting attachment attributes' do
end
it 'should cope with a missing final MIME boundary' do
- pending do
- mail = get_fixture_mail('multipart-no-final-boundary.email')
- attributes = MailHandler.get_attachment_attributes(mail)
- attributes.length.should == 1
- attributes[0][:body].should match(/This is an acknowledgement of your email/)
- attributes[0][:content_type].should == "text/html"
- attributes[0][:url_part_number].should == 1
- end
+ mail = get_fixture_mail('multipart-no-final-boundary.email')
+ attributes = MailHandler.get_attachment_attributes(mail)
+ attributes.length.should == 1
+ attributes[0][:body].should match(/This is an acknowledgement of your email/)
+ attributes[0][:content_type].should == "text/plain"
+ attributes[0][:url_part_number].should == 1
end
it 'should ignore a TNEF attachment with no usable contents' do