Merge pull request #20383 from jonatack/fix-configurable-static-index-filename
Fix regression in #20017 wrong number of arguments error
This commit is contained in:
commit
4519727cdb
|
@ -13,7 +13,7 @@ module ActionDispatch
|
||||||
# located at `public/assets/application.js` if the file exists. If the file
|
# located at `public/assets/application.js` if the file exists. If the file
|
||||||
# does not exist, a 404 "File not Found" response will be returned.
|
# does not exist, a 404 "File not Found" response will be returned.
|
||||||
class FileHandler
|
class FileHandler
|
||||||
def initialize(root, cache_control, index)
|
def initialize(root, cache_control, index = 'index')
|
||||||
@root = root.chomp('/')
|
@root = root.chomp('/')
|
||||||
@compiled_root = /^#{Regexp.escape(root)}/
|
@compiled_root = /^#{Regexp.escape(root)}/
|
||||||
headers = cache_control && { 'Cache-Control' => cache_control }
|
headers = cache_control && { 'Cache-Control' => cache_control }
|
||||||
|
@ -105,7 +105,7 @@ module ActionDispatch
|
||||||
# produce a directory traversal using this middleware. Only 'GET' and 'HEAD'
|
# produce a directory traversal using this middleware. Only 'GET' and 'HEAD'
|
||||||
# requests will result in a file being returned.
|
# requests will result in a file being returned.
|
||||||
class Static
|
class Static
|
||||||
def initialize(app, path, cache_control=nil, index="index")
|
def initialize(app, path, cache_control = nil, index = 'index')
|
||||||
@app = app
|
@app = app
|
||||||
@file_handler = FileHandler.new(path, cache_control, index)
|
@file_handler = FileHandler.new(path, cache_control, index)
|
||||||
end
|
end
|
||||||
|
@ -115,7 +115,7 @@ module ActionDispatch
|
||||||
when 'GET', 'HEAD'
|
when 'GET', 'HEAD'
|
||||||
path = env['PATH_INFO'].chomp('/')
|
path = env['PATH_INFO'].chomp('/')
|
||||||
if match = @file_handler.match?(path)
|
if match = @file_handler.match?(path)
|
||||||
env["PATH_INFO"] = match
|
env['PATH_INFO'] = match
|
||||||
return @file_handler.call(env)
|
return @file_handler.call(env)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue