diff --git a/lib/jekyll/theme.rb b/lib/jekyll/theme.rb index 90536de7..4cd2d163 100644 --- a/lib/jekyll/theme.rb +++ b/lib/jekyll/theme.rb @@ -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) diff --git a/lib/jekyll/url.rb b/lib/jekyll/url.rb index c736c0a6..ba1abbd4 100644 --- a/lib/jekyll/url.rb +++ b/lib/jekyll/url.rb @@ -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