From 709e6330164f6b7156a1f0548afa1f581295192f Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Thu, 14 May 2020 14:28:42 +0530 Subject: [PATCH] Check if entry is a directory once per enumerator (#8177) Merge pull request 8177 --- lib/jekyll/entry_filter.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/entry_filter.rb b/lib/jekyll/entry_filter.rb index 272e7bbbbbc..49404a769be 100644 --- a/lib/jekyll/entry_filter.rb +++ b/lib/jekyll/entry_filter.rb @@ -92,6 +92,7 @@ def symlink_outside_site_source?(entry) # Returns true if path matches against any glob pattern, else false. def glob_include?(enumerator, entry) entry_with_source = PathManager.join(site.source, entry) + entry_is_directory = File.directory?(entry_with_source) enumerator.any? do |pattern| case pattern @@ -100,7 +101,7 @@ def glob_include?(enumerator, entry) File.fnmatch?(pattern_with_source, entry_with_source) || entry_with_source.start_with?(pattern_with_source) || - (pattern_with_source == "#{entry_with_source}/" if File.directory?(entry_with_source)) + (pattern_with_source == "#{entry_with_source}/" if entry_is_directory) when Regexp pattern.match?(entry_with_source) else