diff options
author | Mark Longair <mhl@pobox.com> | 2013-04-30 18:07:50 +0100 |
---|---|---|
committer | Mark Longair <mhl@pobox.com> | 2013-05-16 09:06:27 +0100 |
commit | d51afddb19c2520542d0ad92c8afa2085fae300d (patch) | |
tree | 68b14e64a5aa71c65edfac7ee1a711837a81f642 /spec/lib/mail_handler/mail_handler_spec.rb | |
parent | f93caeb5fad489943615453304b8b41062e67aa5 (diff) |
Add a test for a missing final MIME boundary
If there is a missing final MIME boundary, the behaviour
of Alaveteli with the TMail backend was to still parse
the attachment, but with the new code it currently throws
an exception. This commit adds a test that asserts that
the attachment should be parsed despite the email being
malformed in this way.
Diffstat (limited to 'spec/lib/mail_handler/mail_handler_spec.rb')
-rw-r--r-- | spec/lib/mail_handler/mail_handler_spec.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/lib/mail_handler/mail_handler_spec.rb b/spec/lib/mail_handler/mail_handler_spec.rb index eca5e2dd4..6b01326ed 100644 --- a/spec/lib/mail_handler/mail_handler_spec.rb +++ b/spec/lib/mail_handler/mail_handler_spec.rb @@ -321,6 +321,15 @@ describe 'when getting attachment attributes' do attributes.length.should == 3 end + it 'should cope with a missing final MIME boundary' 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 + it 'should ignore a TNEF attachment with no usable contents' do # FIXME: "no usable contents" is slightly misleading. The # attachment in this example email does have usable content in |