Skip to content

Commit

Permalink
Merge pull request #773 from czj/patch-1
Browse files Browse the repository at this point in the history
Handle deprecation of Rack::File in Rack 3.1
  • Loading branch information
jnunemaker authored Nov 17, 2023
2 parents b0d56f2 + 1fd5292 commit f9ecf17
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/flipper/ui/actions/file.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
require 'rack/file'
if Rack.release >= "2.1"
require 'rack/files'
else
require 'rack/file'
end
require 'flipper/ui/action'

module Flipper
Expand All @@ -8,7 +12,8 @@ class File < UI::Action
route %r{(images|css|js)/.*\Z}

def get
Rack::File.new(public_path).call(request.env)
klass = Rack.release >= "2.1" ? Rack::Files : Rack::File
klass.new(public_path).call(request.env)
end
end
end
Expand Down

0 comments on commit f9ecf17

Please sign in to comment.