Feedback for flubbed regex and prefer File's directory check

This commit is contained in:
Derek Gottlieb 2016-05-28 19:23:23 -05:00
parent 03f7bc1a8c
commit db6050768d
2 changed files with 2 additions and 2 deletions

View File

@ -38,7 +38,7 @@ module Jekyll
return unless resolved_dir
path = Jekyll.sanitized_path(root, resolved_dir)
path if Dir.exist?(path)
path if File.directory?(path)
end
def realpath_for(folder)

View File

@ -92,7 +92,7 @@ module Jekyll
# as well as the beginning "/" so we can enforce and ensure it.
def sanitize_url(str)
"/" + str.gsub(%r!/{2,}!, "/").gsub(%r!\.+\/|\A\/+!, "")
"/" + str.gsub(%r!/{2,}!, "/").gsub(%r!\.+/|\A/+!, "")
end
# Escapes a path to be a valid URL path segment