lib/sup/message_chunks.rb in sup-0.22.1 vs lib/sup/message_chunks.rb in sup-0.23

- old
+ new

@@ -126,21 +126,21 @@ "For some bizarre reason, RubyMail was unable to parse this attachment.\n" end text = case @content_type when /^text\/plain\b/ - @raw_content + @raw_content.force_encoding(encoded_content.charset || 'US-ASCII') else HookManager.run "mime-decode", :content_type => @content_type, :filename => lambda { write_to_disk }, :charset => encoded_content.charset, :sibling_types => sibling_types end @lines = nil if text - text = text.transcode(encoded_content.charset || $encoding, text.encoding) + text = text.encode($encoding, :invalid => :replace, :undef => :replace) begin @lines = text.gsub("\r\n", "\n").gsub(/\t/, " ").gsub(/\r/, "").split("\n") rescue Encoding::CompatibilityError @lines = text.fix_encoding!.gsub("\r\n", "\n").gsub(/\t/, " ").gsub(/\r/, "").split("\n") debug "error while decoding message text, falling back to default encoding, expect errors in encoding: #{text.fix_encoding!}" @@ -158,9 +158,10 @@ else "Attachment: #{filename} (#{content_type}; #{@raw_content.size.to_human_size})" end end def safe_filename; Shellwords.escape(@filename).gsub("/", "_") end + def filesafe_filename; @filename.gsub("/", "_") end ## an attachment is exapndable if we've managed to decode it into ## something we can display inline. otherwise, it's viewable. def inlineable?; false end def expandable?; !viewable? end