aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorElia Schito <elia@schito.me>2012-11-26 23:49:14 +0100
committerElia Schito <elia@schito.me>2012-11-27 00:21:12 +0100
commit5d8faa683e230e6af54ac7616f98f3ae088e7682 (patch)
treef3e09b588ae9cba565649552e2ebccdc9f098514 /actionpack
parent5658923daa2f2c7858f55844168e1872cc611766 (diff)
downloadrails-5d8faa683e230e6af54ac7616f98f3ae088e7682.tar.gz
rails-5d8faa683e230e6af54ac7616f98f3ae088e7682.tar.bz2
rails-5d8faa683e230e6af54ac7616f98f3ae088e7682.zip
Accept symbols as #send_data :disposition value
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG.md2
-rw-r--r--actionpack/lib/action_controller/metal/data_streaming.rb1
-rw-r--r--actionpack/test/controller/send_file_test.rb12
3 files changed, 15 insertions, 0 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md
index 64cd03859d..a8ac9081ec 100644
--- a/actionpack/CHANGELOG.md
+++ b/actionpack/CHANGELOG.md
@@ -1,5 +1,7 @@
## Rails 4.0.0 (unreleased) ##
+* Accept symbols as #send_data :disposition value *Elia Schito*
+
* Add i18n scope to distance_of_time_in_words. *Steve Klabnik*
* `assert_template`:
diff --git a/actionpack/lib/action_controller/metal/data_streaming.rb b/actionpack/lib/action_controller/metal/data_streaming.rb
index 334943818c..75c4d3ef99 100644
--- a/actionpack/lib/action_controller/metal/data_streaming.rb
+++ b/actionpack/lib/action_controller/metal/data_streaming.rb
@@ -150,6 +150,7 @@ module ActionController #:nodoc:
disposition = options.fetch(:disposition, DEFAULT_SEND_FILE_DISPOSITION)
unless disposition.nil?
+ disposition = disposition.to_s
disposition += %(; filename="#{options[:filename]}") if options[:filename]
headers['Content-Disposition'] = disposition
end
diff --git a/actionpack/test/controller/send_file_test.rb b/actionpack/test/controller/send_file_test.rb
index 8bf3096888..5e9053da5b 100644
--- a/actionpack/test/controller/send_file_test.rb
+++ b/actionpack/test/controller/send_file_test.rb
@@ -114,6 +114,18 @@ class SendFileTest < ActionController::TestCase
assert_equal 'private', h['Cache-Control']
end
+ def test_send_file_headers_with_disposition_as_a_symbol
+ options = {
+ :type => Mime::PNG,
+ :disposition => :disposition,
+ :filename => 'filename'
+ }
+
+ @controller.headers = {}
+ @controller.send(:send_file_headers!, options)
+ assert_equal 'disposition; filename="filename"', @controller.headers['Content-Disposition']
+ end
+
def test_send_file_headers_with_mime_lookup_with_symbol
options = {
:type => :png