commit ec36d80f4fd14548608717f84588fab96fc734d5
parent 1b7320cc20aac405ab13cb097b65d96b06419d2a
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date: Sun, 9 Dec 2007 23:11:30 +0000
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
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git 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 }