lib/apipie/static_dispatcher.rb in apipie-rails-1.2.3 vs lib/apipie/static_dispatcher.rb in apipie-rails-1.3.0

- old
+ new

@@ -2,10 +2,16 @@ class FileHandler def initialize(root) @root = root.chomp('/') @compiled_root = /^#{Regexp.escape(root)}/ - @file_server = ::Rack::File.new(@root) + @file_server = if defined?(::Rack::Files) + ::Rack::Files.new(@root) + else + # Deprecated in Rack 3.0, kept + # for backward compatibility + ::Rack::File.new(@root) + end end def match?(path) # Replace all null bytes path = ::Rack::Utils.unescape(path || '')