Skip to content

Commit

Permalink
Rack::File -> Rack::Files (#1877)
Browse files Browse the repository at this point in the history
The alias was deprecated: rack/rack#1811

Looks like Rack::Files appeared in rack 2.1.0 according to
rack/rack@626272b

Sinatra needs at least rack 2.2.4 (since v3.0.0) so this should be fine
  • Loading branch information
dentarg committed Feb 15, 2023
1 parent e19cad1 commit e1c9036
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/sinatra/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def block.each; yield(call) end
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
Expand Down Expand Up @@ -429,7 +429,7 @@ def send_file(path, opts = {})

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 }
Expand Down

0 comments on commit e1c9036

Please sign in to comment.