From: William Morgan Date: Tue, 8 Jan 2008 19:11:57 +0000 (-0800) Subject: strip out \t and \r from text attachments when viewing inline X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=91bae1c8bcfdcb73eabbb83af7766d3c86b9fc87;p=sup strip out \t and \r from text attachments when viewing inline --- 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