From 83ba03721adb4b2446d38aaef9d11522d3a880dc Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Tue, 9 Oct 2012 18:26:22 +0100 Subject: Handle the case where an incoming message is badly encoded and has no charset on the part we're using as a main part. --- spec/models/incoming_message_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec/models') diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb index 03a3c8dc3..cf84b4595 100644 --- a/spec/models/incoming_message_spec.rb +++ b/spec/models/incoming_message_spec.rb @@ -56,6 +56,15 @@ describe IncomingMessage, " when dealing with incoming mail" do message.subject.should == "Câmara Responde: Banco de ideias" end + it 'should not error on display of a message which has no charset set on the body part and + is not good utf-8' do + ir = info_requests(:fancy_dog_request) + receive_incoming_mail('no-part-charset-bad-utf8.email', ir.incoming_email) + puts ir.incoming_messages.inspect + message = ir.incoming_messages[1] + message.parse_raw_email! + message.get_main_body_text_internal.should include("The above text was badly encoded") + end it "should fold multiline sections" do { @@ -77,6 +86,7 @@ describe IncomingMessage, "when parsing HTML mail" do plain_text = IncomingMessage._get_attachment_text_internal_one_file('text/html', html) plain_text.should match(/është/) end + end describe IncomingMessage, "when getting the attachment text" do -- cgit v1.2.3