Fix an edge where file is sometimes not returned properly.

This commit is contained in:
Jordon Bedwell 2015-12-05 04:48:51 -06:00
parent 79ceb4d394
commit b63712e403
1 changed files with 9 additions and 7 deletions

View File

@ -18,24 +18,26 @@ module Jekyll
return super
end
# ---------------------------------------------------------------------
# file > file/index.html > file.html > directory -> Having a directory
# with the same name as a file will result in the file being served the
# way that Nginx behaves (probably not exactly...) For browsing.
# ---------------------------------------------------------------------
# with the same name as a file will result in the file being served the way
# that Nginx behaves (probably not exactly...) For browsing.
def search_file(req, res, basename)
return file if (file = super) || (file = super req, res, "#{basename}.html")
file = super || super(req, res, "#{basename}.html")
return file if file
file = "#{req.path.gsub(/\/\Z/, "")}.html"
if file && File.file?(File.join(@config[:DocumentRoot], file))
return ".html"
end
nil
end
def extract_headers(opts)
@headers = add_defaults(opts.fetch("webrick", {}).fetch("headers", {}))
@headers = add_defaults(opts.fetch("webrick", {}).fetch("headers", {
# Nothing.
}))
end
def add_defaults(opts)