Strip the drive name from both paths when checking the prefix.
This commit is contained in:
parent
4df73ced0d
commit
067f8b6be7
|
@ -141,9 +141,12 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns the sanitized path.
|
# Returns the sanitized path.
|
||||||
def sanitized_path(base_directory, questionable_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 = File.expand_path(questionable_path, "/")
|
||||||
clean_path.gsub!(/\A\w\:\//, '/')
|
clean_path = clean_path.sub(/^\A\w\:\//, '/')
|
||||||
unless clean_path.start_with?(base_directory)
|
|
||||||
|
unless clean_path.start_with?(base_directory.sub(/^\A\w\:\//, '/'))
|
||||||
File.join(base_directory, clean_path)
|
File.join(base_directory, clean_path)
|
||||||
else
|
else
|
||||||
clean_path
|
clean_path
|
||||||
|
|
Loading…
Reference in New Issue