diff options
Diffstat (limited to 'actionmailer/lib')
-rw-r--r-- | actionmailer/lib/action_mailer/part.rb | 13 |
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 |