diff --git a/lib/jekyll/document.rb b/lib/jekyll/document.rb index 048dcdbf..e22e8cf1 100644 --- a/lib/jekyll/document.rb +++ b/lib/jekyll/document.rb @@ -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 diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index 98f730bf..2db39141 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -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 diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index c74522a9..45b6d0d2 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -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