Use safe_glob to unsafe glob
This commit is contained in:
parent
a168edae45
commit
20735e12f9
|
@ -36,19 +36,14 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns a Set with the file paths
|
# Returns a Set with the file paths
|
||||||
def existing_files
|
def existing_files
|
||||||
return Set.new unless Dir.exist?(site.in_dest_dir)
|
|
||||||
|
|
||||||
files = Set.new
|
files = Set.new
|
||||||
regex = keep_file_regex
|
regex = keep_file_regex
|
||||||
dirs = keep_dirs
|
dirs = keep_dirs
|
||||||
|
|
||||||
Dir.chdir(site.in_dest_dir) do
|
Utils.safe_glob(site.in_dest_dir, "**/*", File::FNM_DOTMATCH).each do |file|
|
||||||
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)
|
next if file =~ HIDDEN_FILE_REGEX || file =~ regex || dirs.include?(file)
|
||||||
files << file
|
files << file
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
files
|
files
|
||||||
end
|
end
|
||||||
|
|
|
@ -74,13 +74,10 @@ module Jekyll
|
||||||
def entries
|
def entries
|
||||||
return Array.new unless exists?
|
return Array.new unless exists?
|
||||||
@entries ||=
|
@entries ||=
|
||||||
Dir.chdir(collection_dir) do
|
Utils.safe_glob(collection_dir, "**/*.*").map do |entry|
|
||||||
Dir.glob("**/*.*").map do |f|
|
|
||||||
entry = collection_dir(f)
|
|
||||||
entry["#{collection_dir}/"] = ''; entry
|
entry["#{collection_dir}/"] = ''; entry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
# Filtered version of the entries in this collection.
|
# Filtered version of the entries in this collection.
|
||||||
# See `Jekyll::EntryFilter#filter` for more information.
|
# See `Jekyll::EntryFilter#filter` for more information.
|
||||||
|
|
Loading…
Reference in New Issue