Joe Wölfel
2009-Jun-19 16:23 UTC
[sup-talk] [PATCH] Hack that fixes "undefined method multipart?" exception.
On sup-sync -c I kept getting an exception on line 372 of message.rb in the
message_to_chunks function. The cause was that ''m'' was
supposed to be a
message that needed to be converted to chunks. Instead, it was
aRedwood::Chunk::CryptoNotice, which didn''t have a mulitipart? method.
So it
crashed on "if m.multipart?". My assumption is that a
Redwood::Chunk::CryptoNotice is already a chunk and doesn''t need to be
converted. So my solution is just to return it. That fixes the bug. But
probably there is a more sensible fix. Possibly m should never have been a
chunk in the first place.
---
lib/sup/message.rb | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index ded577a..caf0cdb 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -369,6 +369,11 @@ private
## takes a RMail::Message, breaks it into Chunk:: classes.
def message_to_chunks m, encrypted=false, sibling_types=[]
+ ## TODO: Replace the following four lines with something more sensible.
+ unless m.respond_to? :multipart?
+ puts "I bet this is a Redwood::Chunk::CryptoNotice:
\n#{m.class}"
+ return m
+ end
if m.multipart?
chunks case m.header.content_type
--
1.6.2.1