]> git.cworth.org Git - sup/commitdiff
strip out \t and \r from text attachments when viewing inline
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Tue, 8 Jan 2008 19:11:57 +0000 (11:11 -0800)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Tue, 8 Jan 2008 19:47:29 +0000 (11:47 -0800)
lib/sup/message-chunks.rb

index 7d097404a1daae8b842a6e7fbb5ccde42802e4ad..2fcf8f901637295874e7c6464193b3932a420eda 100644 (file)
@@ -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