Skip to content

Commit

Permalink
Fix usage of Rack::File.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Jan 29, 2025
1 parent 142594d commit b1d7308
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions example/adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ def call(env)
run SimpleAdapter.new
end
map '/files' do
run Rack::File.new('.')
run Rack::Files.new('.')
end
end

# You could also start the server like this:
#
# app = Rack::URLMap.new('/test' => SimpleAdapter.new,
# '/files' => Rack::File.new('.'))
# '/files' => Rack::Files.new('.'))
# Thin::Server.start('0.0.0.0', 3000, app)
#
2 changes: 1 addition & 1 deletion lib/rack/adapter/loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def self.for(name, options={})
return Merb::Rack::Application.new

when :file
return Rack::File.new(options[:chdir])
return Rack::Files.new(options[:chdir])

else
raise AdapterNotFound, "Adapter not found: #{name}"
Expand Down
2 changes: 1 addition & 1 deletion lib/rack/adapter/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def initialize(options = {})
load_application

@rails_app = self.class.rack_based? ? ActionController::Dispatcher.new : CgiApp.new
@file_app = Rack::File.new(::File.join(RAILS_ROOT, "public"))
@file_app = Rack::Files.new(::File.join(RAILS_ROOT, "public"))
end

def load_application
Expand Down

0 comments on commit b1d7308

Please sign in to comment.