mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
0b1a87f73c
Dir.glob can be a security concern. The original use was to provide logic of fallback files. Example a request to `/` should render the file from `/public/index.html`. We can replace the dir glob with the specific logic it represents. The glob {,index,index.html} will look for the current path, then in the directory of the path with index file and then in the directory of the path with index.html. This PR replaces the glob logic by manually checking each potential match. Best case scenario this results in one less file API request, worst case, this has one more file API request. Related to #16464 Update: added a test for when a file of a given name (`public/bar.html` and a directory `public/bar` both exist in the same root directory. Changed logic to accommodate this scenario. |
||
---|---|---|
.. | ||
bar | ||
foo | ||
gzip | ||
400.html | ||
404.html | ||
500.da.html | ||
500.html | ||
bar.html | ||
index.html |