Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix serving files that clash with directories
Jekyll extends WEBrick to serve file.html if file is requested but doesn't exist (see jekyll#3452). This doesn't work if file exists as a directory though. This commit extends WEBrick further so that if file exists as a directory, we first try and serve file/index.html (as normal), but fallback to file.html if no index can be found within the file directory (reported as jekyll#6222). It is slightly hacky, to avoid having to re-implement the entire set_filename method, we instead extend search_index_file and temporarily mutate res.filename. This is all clearly commented. See base class search_index_file implementation: https://github.com/ruby/webrick/blob/3fb6a011/lib/webrick/httpservlet/filehandler.rb#L356-L363
- Loading branch information