Use end_with? instead of regexp for adding index.html

This commit is contained in:
Parker Moore 2015-02-25 11:59:27 -08:00
parent 4da6bfd81a
commit 3f3b203992
3 changed files with 3 additions and 3 deletions

View File

@ -163,7 +163,7 @@ module Jekyll
def destination(base_directory)
dest = site.in_dest_dir(base_directory)
path = site.in_dest_dir(dest, URL.unescape_path(url))
path = File.join(path, "index.html") if url =~ /\/$/
path = File.join(path, "index.html") if url.end_with?("/")
path
end

View File

@ -141,7 +141,7 @@ module Jekyll
# Returns the destination file path String.
def destination(dest)
path = site.in_dest_dir(dest, URL.unescape_path(url))
path = File.join(path, "index.html") if url =~ /\/$/
path = File.join(path, "index.html") if url.end_with?("/")
path
end

View File

@ -279,7 +279,7 @@ module Jekyll
def destination(dest)
# The url needs to be unescaped in order to preserve the correct filename
path = site.in_dest_dir(dest, URL.unescape_path(url))
path = File.join(path, "index.html") if self.url =~ /\/$/
path = File.join(path, "index.html") if self.url.end_with?("/")
path
end