Fixes computation of parent.

If there is a file without a basename in root, e.g. `.htaccess`,
`#parent` of another file in root finds `.htaccess` instead of
`index.html`.

Adding the `.htaccess` to the traversal-app fixture exposes this error.
The fix is to no longer scan for possible files if we know the parent
must be root.
This commit is contained in:
Thomas Ritz 2015-02-21 19:07:17 +01:00
parent ad05b33cf6
commit 262e976790
2 changed files with 3 additions and 1 deletions

View file

@ -9,7 +9,9 @@ module Middleman
tail = parts.pop tail = parts.pop
is_index = (tail == app.index_file) is_index = (tail == app.index_file)
return nil if is_index && parts.length < 1 if parts.empty?
return is_index ? nil : store.find_resource_by_path(app.index_file)
end
test_expr = parts.join('\\/') test_expr = parts.join('\\/')
# A makeshift for eponymous reverse-lookup # A makeshift for eponymous reverse-lookup