Skip to content

Commit

Permalink
Handle deprecation of Rack::File in Rack 3.1
Browse files Browse the repository at this point in the history
When using Rack >= 3.0.0 you get this error message on boot an app with Flipper UI :

```
warning: Rack::File is deprecated and will be removed in Rack 3.1
```

This PR detects if `Rack::Files` is defined and tries to use it instead.

Source : rack/rack#1720
  • Loading branch information
czj committed Nov 13, 2023
1 parent b0d56f2 commit 504ca94
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/flipper/ui/actions/file.rb
Expand Up @@ -8,7 +8,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 504ca94

Please sign in to comment.