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

Fix Rack::File is deprecated and will be removed in Rack 3.1 #604

Merged
merged 1 commit into from Jan 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/mini_profiler/actions.rb
Expand Up @@ -55,7 +55,12 @@ def serve_file(env, file_name:)
resources_env = env.dup
resources_env['PATH_INFO'] = file_name

rack_file = Rack::File.new(resources_root, 'Cache-Control' => "max-age=#{cache_control_value}")
if Gem::Version.new(Rack.release) >= Gem::Version.new("2.1.0")
rack_file = Rack::Files.new(resources_root, 'Cache-Control' => "max-age=#{cache_control_value}")
else
rack_file = Rack::File.new(resources_root, 'Cache-Control' => "max-age=#{cache_control_value}")
end

rack_file.call(resources_env)
end

Expand Down