Avoid using Dir.glob with absolute path
the absolute path including '[', '{', '?', or '*' could change the outcome
This commit is contained in:
parent
03d3eb7191
commit
bd2c337e5b
|
@ -36,14 +36,19 @@ module Jekyll
|
|||
#
|
||||
# Returns a Set with the file paths
|
||||
def existing_files
|
||||
return Set.new unless Dir.exist?(site.in_dest_dir)
|
||||
|
||||
files = Set.new
|
||||
regex = keep_file_regex
|
||||
dirs = keep_dirs
|
||||
|
||||
Dir.glob(site.in_dest_dir("**", "*"), File::FNM_DOTMATCH) do |file|
|
||||
Dir.chdir(site.in_dest_dir) do
|
||||
Dir.glob("**/*", File::FNM_DOTMATCH).each do |f|
|
||||
file = File.join(site.in_dest_dir, f)
|
||||
next if file =~ HIDDEN_FILE_REGEX || file =~ regex || dirs.include?(file)
|
||||
files << file
|
||||
end
|
||||
end
|
||||
|
||||
files
|
||||
end
|
||||
|
|
|
@ -74,10 +74,13 @@ module Jekyll
|
|||
def entries
|
||||
return Array.new unless exists?
|
||||
@entries ||=
|
||||
Dir.glob(collection_dir("**", "*.*")).map do |entry|
|
||||
Dir.chdir(collection_dir) do
|
||||
Dir.glob("**/*.*").map do |f|
|
||||
entry = collection_dir(f)
|
||||
entry["#{collection_dir}/"] = ''; entry
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Filtered version of the entries in this collection.
|
||||
# See `Jekyll::EntryFilter#filter` for more information.
|
||||
|
|
Loading…
Reference in New Issue