Skip to content

Commit

Permalink
Replaced deprecated Rack::File to Rack::Files with rack v2.1.0+ (#604)
Browse files Browse the repository at this point in the history
  • Loading branch information
taketo1113 committed Jan 2, 2024
1 parent eb8e847 commit fd2d5d3
Showing 1 changed file with 6 additions and 1 deletion.
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

0 comments on commit fd2d5d3

Please sign in to comment.