From acfb8b6191338cdb04707e2e1e8ac1cdbb595b4f Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Mon, 23 Jan 2006 16:37:46 +0000 Subject: 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 --- actionmailer/lib/action_mailer/vendor/tmail/attachments.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'actionmailer/lib/action_mailer/vendor/tmail') 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) || -- cgit v1.2.3