From 91bae1c8bcfdcb73eabbb83af7766d3c86b9fc87 Mon Sep 17 00:00:00 2001 From: William Morgan Date: Tue, 8 Jan 2008 11:11:57 -0800 Subject: [PATCH] strip out \t and \r from text attachments when viewing inline --- lib/sup/message-chunks.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb index 7d09740..2fcf8f9 100644 --- a/lib/sup/message-chunks.rb +++ b/lib/sup/message-chunks.rb @@ -72,20 +72,20 @@ EOS "For some bizarre reason, RubyMail was unable to parse this attachment.\n" end - @lines = + text = case @content_type when /^text\/plain\b/ - @quotable = true - Message.convert_from(@raw_content, encoded_content.charset).split("\n") + Message.convert_from @raw_content, encoded_content.charset else - text = HookManager.run "mime-decode", :content_type => content_type, - :filename => lambda { write_to_disk }, - :sibling_types => sibling_types - if text - @quotable = true - text.split("\n") - end + HookManager.run "mime-decode", :content_type => content_type, + :filename => lambda { write_to_disk }, + :sibling_types => sibling_types end + + if text + @lines = text.gsub("\r\n", "\n").gsub(/\t/, " ").gsub(/\r/, "").split("\n") + @quotable = true + end end def color; :none end -- 2.45.2