From: wmorgan Date: Sun, 9 Dec 2007 23:11:30 +0000 (+0000) Subject: possible bugfix in message decoding (body returning nil for some reason) X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=ec36d80f4fd14548608717f84588fab96fc734d5;p=sup possible bugfix in message decoding (body returning nil for some reason) git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@754 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- diff --git a/lib/sup/message.rb b/lib/sup/message.rb index 4131bfe..eb5f2bc 100644 --- a/lib/sup/message.rb +++ b/lib/sup/message.rb @@ -370,7 +370,7 @@ private ## otherwise, it's body text else body = Message.convert_from m.decode, m.charset - text_to_chunks body.normalize_whitespace.split("\n") + text_to_chunks (body || "").normalize_whitespace.split("\n") end end end @@ -379,7 +379,7 @@ private begin raise MessageFormatError, "RubyMail decode returned a null body" unless body return body unless charset - Iconv.iconv($encoding, charset, body).join + Iconv.iconv($encoding + "//IGNORE", charset, body + " ").join[0 .. -2] rescue Errno::EINVAL, Iconv::InvalidEncoding, Iconv::IllegalSequence, MessageFormatError => e Redwood::log "warning: error (#{e.class.name}) decoding message body from #{charset}: #{e.message}" File.open("sup-unable-to-decode.txt", "w") { |f| f.write body }