Permalink
Browse files

Only include attachments that arent blank

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@918 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 8ccbe90 commit 1f6c871856b054ed0eb159a5a4449649ac5f69ab @dhh dhh committed Mar 19, 2005
Showing with 8 additions and 2 deletions.
  1. +8 −2 actionmailer/lib/action_mailer/vendor/tmail/attachments.rb
@@ -14,8 +14,14 @@ def attachments
if multipart?
parts.collect { |part|
if part.header["content-type"].main_type != "text"
- attachment = Attachment.new(Base64.decode64(part.body))
- attachment.original_filename = part.header["content-type"].params["name"].strip.dup
+ content = part.body.unpack("m")[0]
+ content = part.body if content.blank?
+ file_name = part.header["content-type"].params["name"]
+
+ next if file_name.blank? || content.blank?
+
+ attachment = Attachment.new(content)
+ attachment.original_filename = file_name.strip.dup
attachment
end
}.compact

0 comments on commit 1f6c871

Please sign in to comment.