Subject: [sup-talk] [PATCH] Handle nil charset on attachments.

From: [email-masked] (Mark Alexander)
Date: Tue, 02 Jun 2009 09:29:13 -0700

I updated to the latest 'next' branch of sup
this morning, and immediately ran into a crash
when viewing a message with an attachement, which
was probably sent by an Outlook user.  The crash
was due to a nil charset; this patch fixes the crash.
---
 lib/sup/message-chunks.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
index 3f57346..41d924b 100644
--- a/lib/sup/message-chunks.rb
+++ b/lib/sup/message-chunks.rb
@@ -98,7 +98,7 @@ EOS
       text =
         case @content_type
         when /^text\/plain\b/
-          Iconv.easy_decode $encoding, encoded_content.charset, @raw_content
+          Iconv.easy_decode $encoding, encoded_content.charset || $encoding, @raw_content
         else
           HookManager.run "mime-decode", :content_type => content_type,
                           :filename => lambda { write_to_disk },

---

From: [email-masked] (William Morgan)
Date: Tue, 02 Jun 2009 09:46:00 -0700

Reformatted excerpts from Mark Alexander's message of 2009-06-02:
> I updated to the latest 'next' branch of sup this morning, and
> immediately ran into a crash when viewing a message with an
> attachement, which was probably sent by an Outlook user. The crash

Sloppy of me. Applied, thanks!
-- 
William <wmorgan-sup at masanjin.net>