Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't blow up when passing frozen string to send_file disposition. #1137

Merged
merged 2 commits into from
Aug 4, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use dup instead of String.new
  • Loading branch information
Andrew Selder committed Jul 20, 2016
commit 0fd085ca41c32b7c579ea49989e4a46a78c9492a
2 changes: 1 addition & 1 deletion lib/sinatra/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down