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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -879,6 +879,12 @@ def send_file_app(opts={}) | |
assert_equal 'inline; filename="file.txt"', response['Content-Disposition'] | ||
end | ||
|
||
it "does not raise an error when :disposition set to a frozen string" do | ||
send_file_app :disposition => 'inline'.freeze | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where does this actually occur? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @zzak It happened to up when we added the magic frozen string literal comment at the top of our files. Since we had As rubocop, code climate, etc are now flagging files with string literals non-frozen I suspect this will be coming up more and more There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have the same problem after passing the script through rubocop |
||
get '/file.txt' | ||
assert_equal 'inline; filename="file.txt"', response['Content-Disposition'] | ||
end | ||
|
||
it "sets the Content-Disposition header when :filename provided" do | ||
send_file_app :filename => 'foo.txt' | ||
get '/file.txt' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't
dup
be more natural here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah,
dup
should work... let me update