diff options
author | Jamis Buck <jamis@37signals.com> | 2006-01-23 16:37:46 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2006-01-23 16:37:46 +0000 |
commit | acfb8b6191338cdb04707e2e1e8ac1cdbb595b4f (patch) | |
tree | 640479805c365dd8b1399d66cd62aa53e3cc1dee /actionmailer/lib | |
parent | 7d0d0f0edd953b099351813882d20c27607a8906 (diff) | |
download | rails-acfb8b6191338cdb04707e2e1e8ac1cdbb595b4f.tar.gz rails-acfb8b6191338cdb04707e2e1e8ac1cdbb595b4f.tar.bz2 rails-acfb8b6191338cdb04707e2e1e8ac1cdbb595b4f.zip |
Make sure TMail#attachments includes anything with content-disposition of "attachment", regardless of content-type
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3474 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionmailer/lib')
-rw-r--r-- | actionmailer/lib/action_mailer/vendor/tmail/attachments.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/actionmailer/lib/action_mailer/vendor/tmail/attachments.rb b/actionmailer/lib/action_mailer/vendor/tmail/attachments.rb index cdc4ba8631..abadd20a8a 100644 --- a/actionmailer/lib/action_mailer/vendor/tmail/attachments.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail/attachments.rb @@ -10,10 +10,15 @@ module TMail multipart? && parts.any? { |part| part.header["content-type"].main_type != "text" } end + def attachment?(part) + (part['content-disposition'] && part['content-disposition'].disposition == "attachment") || + part.header['content-type'].main_type != "text" + end + def attachments if multipart? parts.collect { |part| - if part.header["content-type"].main_type != "text" + if attachment?(part) content = part.body # unquoted automatically by TMail#body file_name = (part['content-location'] && part['content-location'].body) || |