aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2005-07-04 16:11:22 +0000
committerJamis Buck <jamis@37signals.com>2005-07-04 16:11:22 +0000
commit06052cb34c578879e2e835321eee9b14e76adf9e (patch)
treefaf5162b8dc0cb685ef7df98a3a525eb19411a53 /actionmailer/lib
parent6e7e552b039c66d1ad5251651d01e0ea097163c5 (diff)
downloadrails-06052cb34c578879e2e835321eee9b14e76adf9e.tar.gz
rails-06052cb34c578879e2e835321eee9b14e76adf9e.tar.bz2
rails-06052cb34c578879e2e835321eee9b14e76adf9e.zip
Avoid adding nil values to mail headers #1392
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1666 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionmailer/lib')
-rw-r--r--actionmailer/lib/action_mailer/part.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/actionmailer/lib/action_mailer/part.rb b/actionmailer/lib/action_mailer/part.rb
index b47961a744..7b9260f225 100644
--- a/actionmailer/lib/action_mailer/part.rb
+++ b/actionmailer/lib/action_mailer/part.rb
@@ -40,9 +40,9 @@ module ActionMailer
# non-attachment parts)
if content_disposition == "attachment"
part.set_content_type(content_type || defaults.content_type, nil,
- "charset" => nil,
- "name" => filename)
- part.set_content_disposition(content_disposition, "filename" => filename)
+ squish("charset" => nil, "name" => filename))
+ part.set_content_disposition(content_disposition,
+ squish("filename" => filename))
else
part.set_content_type(content_type || defaults.content_type, nil,
"charset" => (charset || defaults.charset))
@@ -65,9 +65,14 @@ module ActionMailer
part.set_content_type(content_type, nil, { "charset" => charset }) if content_type =~ /multipart/
end
-
part
end
+
+ private
+
+ def squish(values={})
+ values.delete_if { |k,v| v.nil? }
+ end
end
end