Skip to content

Commit

Permalink
Replaced deprecated Rack::File to Rack::Files with rack v2.1.0+
Browse files Browse the repository at this point in the history
  • Loading branch information
taketo1113 committed Dec 31, 2023
1 parent eb8e847 commit 2fab16f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/mini_profiler/actions.rb
Original file line number Diff line number Diff line change
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 2fab16f

Please sign in to comment.