diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-19 15:37:26 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-19 15:37:26 +0000 |
commit | 1f6c871856b054ed0eb159a5a4449649ac5f69ab (patch) | |
tree | 48f7a7e1be07ec862bf6d8eaaa58ec8161fb9422 | |
parent | 8ccbe90a07560f17d71b45a1b8b1fc34b1d7b7d6 (diff) | |
download | rails-1f6c871856b054ed0eb159a5a4449649ac5f69ab.tar.gz rails-1f6c871856b054ed0eb159a5a4449649ac5f69ab.tar.bz2 rails-1f6c871856b054ed0eb159a5a4449649ac5f69ab.zip |
Only include attachments that arent blank
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@918 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | actionmailer/lib/action_mailer/vendor/tmail/attachments.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/actionmailer/lib/action_mailer/vendor/tmail/attachments.rb b/actionmailer/lib/action_mailer/vendor/tmail/attachments.rb index fb6629d67e..52455e5d2d 100644 --- a/actionmailer/lib/action_mailer/vendor/tmail/attachments.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail/attachments.rb @@ -14,8 +14,14 @@ module TMail 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 |