diff options
author | Louise Crow <louise.crow@gmail.com> | 2015-06-04 19:17:15 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2015-06-04 19:17:15 +0100 |
commit | 4da1e6620cf022040c9ac0c5192697b995a0b0b3 (patch) | |
tree | eed6b9d5a2e6efa1d87b8031ab0d5db5d407f2b8 /spec/models/incoming_message_spec.rb | |
parent | c24c8093089452363940388cd3bb2d9298ca9a1c (diff) | |
parent | 26dbf38319f22de55d6c8bfbf3376df0dbb297c2 (diff) |
Merge branch 'develop' of ssh://git.mysociety.org/data/git/public/alaveteli into develop
Diffstat (limited to 'spec/models/incoming_message_spec.rb')
-rw-r--r-- | spec/models/incoming_message_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb index 10bb3de62..8fb57e36c 100644 --- a/spec/models/incoming_message_spec.rb +++ b/spec/models/incoming_message_spec.rb @@ -503,6 +503,20 @@ end describe IncomingMessage, " when uudecoding bad messages" do + it "decodes a valid uuencoded attachment" do + mail = get_fixture_mail('simple-uuencoded-attachment.email') + im = incoming_messages(:useless_incoming_message) + im.stub!(:mail).and_return(mail) + im.extract_attachments! + + im.reload + attachments = im.foi_attachments + attachments.size.should == 2 + attachments[1].filename.should == 'Happy.txt' + attachments[1].body.should == "Happy today for to be one of peace and serene time.\n" + im.get_attachments_for_display.size.should == 1 + end + it "should be able to do it at all" do mail = get_fixture_mail('incoming-request-bad-uuencoding.email') im = incoming_messages(:useless_incoming_message) @@ -516,6 +530,21 @@ describe IncomingMessage, " when uudecoding bad messages" do im.get_attachments_for_display.size.should == 1 end + it "decodes an attachment where the uudecode program reports a 'No end line' error" do + # See https://github.com/mysociety/alaveteli/issues/2508 + mail = get_fixture_mail('incoming-request-bad-uuencoding-2.email') + im = incoming_messages(:useless_incoming_message) + im.stub!(:mail).and_return(mail) + im.extract_attachments! + + im.reload + attachments = im.foi_attachments + attachments.size.should == 2 + attachments[1].filename.should == 'ResponseT5741 15.doc' + attachments[1].display_size.should == '123K' + im.get_attachments_for_display.size.should == 1 + end + it "should still work when parsed from the raw email" do raw_email = load_file_fixture 'inline-uuencode.email' mail = MailHandler.mail_from_raw_email(raw_email) |