Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: kkourt@cslab.ece.ntua.gr (Kornilios Kourtis)
Subject: [sup-talk] [PATCH] handle malformed multiplart messages
Date: Tue, 28 Jul 2009 19:58:23 +0300	[thread overview]
Message-ID: <20090728165823.GA29533@solar.cslab.ece.ntua.gr> (raw)

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



             reply	other threads:[~2009-07-28 16:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-28 16:58 Kornilios Kourtis [this message]
2009-09-04 15:53 ` William Morgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090728165823.GA29533@solar.cslab.ece.ntua.gr \
    --to=kkourt@cslab.ece.ntua.gr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox