sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 91bae1c8bcfdcb73eabbb83af7766d3c86b9fc87
parent 385c5e85852e1a2c81ce3672e90fa1d021f7bd3f
Author: William Morgan <wmorgan-sup@masanjin.net>
Date:   Tue,  8 Jan 2008 11:11:57 -0800

strip out \t and \r from text attachments when viewing inline

Diffstat:
M 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
@@ -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