Feedback for flubbed regex and prefer File's directory check
This commit is contained in:
parent
03f7bc1a8c
commit
db6050768d
|
@ -38,7 +38,7 @@ module Jekyll
|
||||||
return unless resolved_dir
|
return unless resolved_dir
|
||||||
|
|
||||||
path = Jekyll.sanitized_path(root, resolved_dir)
|
path = Jekyll.sanitized_path(root, resolved_dir)
|
||||||
path if Dir.exist?(path)
|
path if File.directory?(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def realpath_for(folder)
|
def realpath_for(folder)
|
||||||
|
|
|
@ -92,7 +92,7 @@ module Jekyll
|
||||||
# as well as the beginning "/" so we can enforce and ensure it.
|
# as well as the beginning "/" so we can enforce and ensure it.
|
||||||
|
|
||||||
def sanitize_url(str)
|
def sanitize_url(str)
|
||||||
"/" + str.gsub(%r!/{2,}!, "/").gsub(%r!\.+\/|\A\/+!, "")
|
"/" + str.gsub(%r!/{2,}!, "/").gsub(%r!\.+/|\A/+!, "")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Escapes a path to be a valid URL path segment
|
# Escapes a path to be a valid URL path segment
|
||||||
|
|
Loading…
Reference in New Issue