Check symlink outside site_source without Pathutil (#9015)

Merge pull request 9015
This commit is contained in:
Ashwin Maroli 2022-04-03 22:28:57 +05:30 committed by GitHub
parent 19868d5602
commit 9c7972dc38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 6 deletions

View File

@ -86,14 +86,10 @@ module Jekyll
end end
# -- # --
# NOTE: Pathutil#in_path? gets the realpath. # Check if given path is outside of current site's configured source directory.
# @param [<Anything>] entry the entry you want to validate.
# Check if a path is outside of our given root.
# -- # --
def symlink_outside_site_source?(entry) def symlink_outside_site_source?(entry)
!Pathutil.new(entry).in_path?( !File.realpath(entry).start_with?(site.in_source_dir)
site.in_source_dir
)
end end
# Check if an entry matches a specific pattern. # Check if an entry matches a specific pattern.