Browse files

Make TMail::Mail#has_attachments? use logic from #attachment? (closes #…

…3815) [devslashnull@gmail.com]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3652 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 5e99422 commit 4bd80f110d41a02ddc76212a92b5367541e6bce7 @dhh dhh committed Feb 25, 2006
View
2 actionmailer/lib/action_mailer/vendor/tmail/attachments.rb
@@ -7,7 +7,7 @@ class Attachment < StringIO
class Mail
def has_attachments?
- multipart? && parts.any? { |part| part.header["content-type"].main_type != "text" }
+ multipart? && parts.any? { |part| attachment?(part) }
end
def attachment?(part)
View
1 actionmailer/test/mail_service_test.rb
@@ -590,6 +590,7 @@ def test_attachment_using_content_location
def test_attachment_with_text_type
fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email13")
mail = TMail::Mail.parse(fixture)
+ assert mail.has_attachments?
assert_equal 1, mail.attachments.length
assert_equal "hello.rb", mail.attachments.first.original_filename
end

0 comments on commit 4bd80f1

Please sign in to comment.