Subject: [sup-talk] [PATCH] handle malformed multiplart messages

From: [email-masked] (Kornilios Kourtis)
Date: Tue, 28 Jul 2009 19:58:23 +0300

Hi,

I've tried to use sup-mail, but sup-sync blows up due to some malformed
messages I keep in my mailbox. Below is a quick patch that seems to fix the
above issue for me.

Thanks,

-- 
Kornilios Kourtis

diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index ded577a..c6e6baf 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -385,11 +385,15 @@ private
 
       chunks
     elsif m.header.content_type == "message/rfc822"
-      payload = RMail::Parser.read(m.body)
-      from = payload.header.from.first
-      from_person = from ? Person.from_address(from.format) : nil
-      [Chunk::EnclosedMessage.new(from_person, payload.to_s)] +
-        message_to_chunks(payload, encrypted)
+      if m.body
+        payload = RMail::Parser.read(m.body)
+        from = payload.header.from.first
+        from_person = from ? Person.from_address(from.format) : nil
+        [Chunk::EnclosedMessage.new(from_person, payload.to_s)] +
+          message_to_chunks(payload, encrypted)
+       else
+        [Chunk::EnclosedMessage.new(nil, "")]
+       end
     else
       filename =
         ## first, paw through the headers looking for a filename

---

From: [email-masked] (William Morgan)
Date: Fri, 04 Sep 2009 08:53:12 -0700

> messages I keep in my mailbox. Below is a quick patch that seems to fix the

Sorry for the delay. I think this is good. Applied. Thanks!
-- 
William <wmorgan-sup at masanjin.net>