lib/sup/message.rb in sup-0.9 vs lib/sup/message.rb in sup-0.9.1
- old
+ new
@@ -492,15 +492,17 @@
["sup-attachment-#{Time.now.to_i}-#{rand 10000}", extension].join(".")
end
## if there's a filename, we'll treat it as an attachment.
if filename
+ ## filename could be 2047 encoded
+ filename = Rfc2047.decode_to $encoding, filename
# add this to the attachments list if its not a generated html
# attachment (should we allow images with generated names?).
# Lowercase the filename because searches are easier that way
@attachments.push filename.downcase unless filename =~ /^sup-attachment-/
add_label :attachment unless filename =~ /^sup-attachment-/
- content_type = m.header.content_type.downcase || "application/unknown" # sometimes RubyMail gives us nil
+ content_type = (m.header.content_type || "application/unknown").downcase # sometimes RubyMail gives us nil
[Chunk::Attachment.new(content_type, filename, m, sibling_types)]
## otherwise, it's body text
else
## if there's no charset, use the current encoding as the charset.