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

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

merged 2 commits into from Aug 4, 2018

Commits on Jul 19, 2016

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

    Since `attachment` does an in-place mutation of `response['Content-Disposition']`, we need to guarantee that this object is not frozen. If a frozen string is passed in, `to_s` is a no-op and returned the same frozen string. So we need to make a new unfrozen string to allow this to work.
    
    Also this could have had interesting side effects if the user had passed in a string while holding a reference to it, they would have found their string to be changed by the call to send_file
    
    ```
    x = 'inline'
    send_file(some_path, disposition: x)
    x == 'inline' #=> false
    ```
    Andrew Selder committed Jul 19, 2016
    Copy the full SHA
    746e245 View commit details
    Browse the repository at this point in the history

Commits on Jul 20, 2016

  1. Use dup instead of String.new

    Andrew Selder committed Jul 20, 2016
    Copy the full SHA
    0fd085c View commit details
    Browse the repository at this point in the history