From 0fd085ca41c32b7c579ea49989e4a46a78c9492a Mon Sep 17 00:00:00 2001 From: Andrew Selder Date: Tue, 19 Jul 2016 20:32:05 -0700 Subject: [PATCH] Use `dup` instead of String.new --- lib/sinatra/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index 3ab0878a09..168c34149f 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -358,7 +358,7 @@ def content_type(type = nil, params = {}) # Set the Content-Disposition to "attachment" with the specified filename, # instructing the user agents to prompt to save. def attachment(filename = nil, disposition = :attachment) - response['Content-Disposition'] = String.new(disposition.to_s) + response['Content-Disposition'] = disposition.to_s.dup if filename params = '; filename="%s"' % File.basename(filename) response['Content-Disposition'] << params