Strip the drive name from both paths when checking the prefix.

This commit is contained in:
Parker Moore 2014-11-08 13:10:28 -08:00
parent 4df73ced0d
commit 067f8b6be7
1 changed files with 5 additions and 2 deletions

View File

@ -141,9 +141,12 @@ module Jekyll
#
# Returns the sanitized path.
def sanitized_path(base_directory, questionable_path)
return base_directory if base_directory.eql?(questionable_path)
clean_path = File.expand_path(questionable_path, "/")
clean_path.gsub!(/\A\w\:\//, '/')
unless clean_path.start_with?(base_directory)
clean_path = clean_path.sub(/^\A\w\:\//, '/')
unless clean_path.start_with?(base_directory.sub(/^\A\w\:\//, '/'))
File.join(base_directory, clean_path)
else
clean_path