From 2fab16fb8ca7060e4b9f590e70ccd7aadcbee91a Mon Sep 17 00:00:00 2001 From: Taketo Takashima Date: Mon, 1 Jan 2024 01:35:21 +0900 Subject: [PATCH] Replaced deprecated Rack::File to Rack::Files with rack v2.1.0+ --- lib/mini_profiler/actions.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/mini_profiler/actions.rb b/lib/mini_profiler/actions.rb index 55ebc3cb..f4b10251 100644 --- a/lib/mini_profiler/actions.rb +++ b/lib/mini_profiler/actions.rb @@ -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