Subject: [sup-talk] [PATCH] Fix message_to_chunks for the m.body == nil case.

From: [email-masked] (Carl Worth)
Date: Thu, 17 Sep 2009 13:05:45 -0700

The code was previously broken in calling EnclosedMessage.new with
only 2 instead of 5 arguments.
---

A friend of mine couldn't import his mail into sup due to the crash
fixed by this patch. It looks like the message he had that was causing
this infrequently-used (and obviously broken) code to be executed had
some mime pieces corrupted.

The message consisted of several mime-attached messages looking like:

	--==_Exmh_5062123120
	Content-Type: message/rfc822 ; name="5714"
	Content-Description: 5714
	Content-Disposition: attachment; filename="5714"
	
	Return-path: <omitted>
	...

but one part was missing the mime searpate and Content-Type and
instead just looked like:

	Content-Description: 5692
	Content-Disposition: attachment; filename="5692"

	Return-path: <omitted>
	...

I tried fixing this first by adding several more empty-string
arguments, that is:

	[Chunk::EnclosedMessage.new(nil, "", "", "", "")]

but that ended up causing this exception instead:

	./lib/sup/message-chunks.rb:212:in `initialize': undefined
	method `full_adress' for nil:NilClass (NoMethodError)

So I'm not 100% sure that this patch is correct, but it does allow
sup-sync to proceed and the message appears in sup as well as could be
expected, (the "extra" headers from the corrupted mime part appear in
the body as one might expect here).

-Carl

 lib/sup/message.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index afa8f00..579c1e5 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -453,7 +453,7 @@ private
         cc_people = cc ? Person.from_address_list(cc) : nil
         [Chunk::EnclosedMessage.new(from_person, to_people, cc_people, msgdate, subj)] + message_to_chunks(payload, encrypted)
       else
-        [Chunk::EnclosedMessage.new(nil, "")]
+        []
       end
     else
       filename =
-- 
1.6.4.3

---

From: [email-masked] (William Morgan)
Date: Sat, 26 Sep 2009 11:12:24 -0700

> only 2 instead of 5 arguments.

Thanks, this has been applied.

> the body as one might expect here).

Yeah, I think that's the best we can hope for here.
-- 
William <wmorgan-sup at masanjin.net>