mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
Jekyll.sanitized_path: sanitizing a questionable path should handle tildes
This commit is contained in:
@@ -153,8 +153,9 @@ module Jekyll
|
||||
def sanitized_path(base_directory, questionable_path)
|
||||
return base_directory if base_directory.eql?(questionable_path)
|
||||
|
||||
questionable_path.insert(0, '/') if questionable_path.start_with?('~')
|
||||
clean_path = File.expand_path(questionable_path, "/")
|
||||
clean_path = clean_path.sub(/\A\w\:\//, '/')
|
||||
clean_path.sub!(/\A\w\:\//, '/')
|
||||
|
||||
if clean_path.start_with?(base_directory.sub(/\A\w\:\//, '/'))
|
||||
clean_path
|
||||
|
||||
Reference in New Issue
Block a user