4 FILE_METHODS
= %w(GET HEAD
).freeze
8 @file_server = ::Rack::File.new(File
.join(RAILS_ROOT
, "public"))
12 path
= env['PATH_INFO'].chomp('/')
13 method
= env['REQUEST_METHOD']
14 cached_path
= (path
.empty
? ? 'index' : path
) + ::ActionController::Base.page_cache_extension
16 if FILE_METHODS
.include?(method
)
18 return @file_server.call(env)
19 elsif file_exist
?(cached_path
)
20 env['PATH_INFO'] = cached_path
21 return @file_server.call(env)
30 full_path
= File
.join(@file_server.root
, ::Rack::Utils.unescape(path
))
31 File
.file
?(full_path
) && File
.readable
?(full_path
)