`Rack::File` -> `Rack::Files` (#1877)

The alias was deprecated: https://github.com/rack/rack/pull/1811

Looks like Rack::Files appeared in rack 2.1.0 according to
626272b2bc

Sinatra needs at least rack 2.2.4 (since v3.0.0) so this should be fine
This commit is contained in:
Patrik Ragnarsson 2023-02-16 00:04:06 +01:00 committed by GitHub
parent e19cad1cb1
commit e1c903621c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -291,7 +291,7 @@ module Sinatra
elsif value
# Rack 2.0 returns a Rack::File::Iterator here instead of
# Rack::File as it was in the previous API.
unless request.head? || value.is_a?(Rack::File::Iterator) || value.is_a?(Stream)
unless request.head? || value.is_a?(Rack::Files::Iterator) || value.is_a?(Stream)
headers.delete 'Content-Length'
end
response.body = value
@ -429,7 +429,7 @@ module Sinatra
last_modified opts[:last_modified] if opts[:last_modified]
file = Rack::File.new(File.dirname(settings.app_file))
file = Rack::Files.new(File.dirname(settings.app_file))
result = file.serving(request, path)
result[1].each { |k, v| headers[k] ||= v }