From 7892c5e1f392061c3d6862a83cefb6da8f134b6d Mon Sep 17 00:00:00 2001 From: "Heng, K. (Stephen)" Date: Thu, 25 Aug 2016 18:35:09 +0800 Subject: [PATCH] Fix issue #5276, where path strips root destination dir if filename matches --- lib/jekyll.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index ffe9e4ac..f3c38f53 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -161,7 +161,9 @@ module Jekyll questionable_path.insert(0, "/") if questionable_path.start_with?("~") clean_path = File.expand_path(questionable_path, "/") - if clean_path.start_with?(base_directory) + return clean_path if clean_path.eql?(base_directory) + + if clean_path.start_with?(base_directory.sub(%r!\z!, "/")) clean_path else clean_path.sub!(%r!\A\w:/!, "/")