Make directory_indexes check the destination_path

If the destination_path matches the index_file but the original path
does not (as can happen with proxied resources) then directory_indexes
will add the index file a second time, e.g. resource.path = "myres.html"
and resource.destination_path = "myres/index.html" then
directory_indexes will convert this to resource.destination_path =
"myres/index/index.html". This patch fixes that by making
directory_indexes check the destination_path when determining whether to
reroute.
This commit is contained in:
Tim Bates 2012-07-12 15:02:48 +09:30
parent 692aa10c8b
commit 2117cbac79

View file

@ -34,8 +34,8 @@ module Middleman
resources.each do |resource| resources.each do |resource|
# Check if it would be pointless to reroute # Check if it would be pointless to reroute
next if resource.path == index_file || next if resource.destination_path == index_file ||
resource.path.end_with?(new_index_path) || resource.destination_path.end_with?(new_index_path) ||
File.extname(index_file) != resource.ext File.extname(index_file) != resource.ext
# Check if frontmatter turns directory_index off # Check if frontmatter turns directory_index off