Permalink
Browse files

Merge pull request #8329 from elia/fix-send-data-disposition-with-sym…

…bols-master

Accept symbols as #send_data :disposition value
  • Loading branch information...
2 parents 5658923 + 5d8faa6 commit fe4571259daab2738908da83b0c2c4387ba139e5 @carlosantoniodasilva carlosantoniodasilva committed Nov 26, 2012
@@ -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`:
@@ -150,6 +150,7 @@ def send_file_headers!(options)
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
@@ -114,6 +114,18 @@ def test_send_file_headers_bang
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

0 comments on commit fe45712

Please sign in to comment.