]> git.cworth.org Git - sup/commitdiff
possible bugfix in message decoding (body returning nil for some reason)
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sun, 9 Dec 2007 23:11:30 +0000 (23:11 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sun, 9 Dec 2007 23:11:30 +0000 (23:11 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@754 5c8cc53c-5e98-4d25-b20a-d8db53a31250

lib/sup/message.rb

index 4131bfe42bf77c0f081bfae0580f238adf0501f3..eb5f2bc4a9211765db76da38ac947c6a3ae65b1e 100644 (file)
@@ -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 }