Fix issue #5276, where path strips root destination dir if filename matches

This commit is contained in:
Heng, K. (Stephen) 2016-08-25 18:35:09 +08:00
parent 596f5d1af3
commit 7892c5e1f3
1 changed files with 3 additions and 1 deletions

View File

@ -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:/!, "/")