From 9c7972dc386d32c498f3f003f1c47e853c3a6a36 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Sun, 3 Apr 2022 22:28:57 +0530 Subject: [PATCH] Check symlink outside site_source without Pathutil (#9015) Merge pull request 9015 --- lib/jekyll/entry_filter.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/jekyll/entry_filter.rb b/lib/jekyll/entry_filter.rb index 936dd7c3..4e70a5d9 100644 --- a/lib/jekyll/entry_filter.rb +++ b/lib/jekyll/entry_filter.rb @@ -86,14 +86,10 @@ module Jekyll end # -- - # NOTE: Pathutil#in_path? gets the realpath. - # @param [] entry the entry you want to validate. - # Check if a path is outside of our given root. + # Check if given path is outside of current site's configured source directory. # -- def symlink_outside_site_source?(entry) - !Pathutil.new(entry).in_path?( - site.in_source_dir - ) + !File.realpath(entry).start_with?(site.in_source_dir) end # Check if an entry matches a specific pattern.