Use safe_glob to unsafe glob
This commit is contained in:
parent
a168edae45
commit
20735e12f9
|
@ -36,18 +36,13 @@ 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.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
|
||||
Utils.safe_glob(site.in_dest_dir, "**/*", File::FNM_DOTMATCH).each do |file|
|
||||
next if file =~ HIDDEN_FILE_REGEX || file =~ regex || dirs.include?(file)
|
||||
files << file
|
||||
end
|
||||
|
||||
files
|
||||
|
|
|
@ -74,11 +74,8 @@ module Jekyll
|
|||
def entries
|
||||
return Array.new unless exists?
|
||||
@entries ||=
|
||||
Dir.chdir(collection_dir) do
|
||||
Dir.glob("**/*.*").map do |f|
|
||||
entry = collection_dir(f)
|
||||
entry["#{collection_dir}/"] = ''; entry
|
||||
end
|
||||
Utils.safe_glob(collection_dir, "**/*.*").map do |entry|
|
||||
entry["#{collection_dir}/"] = ''; entry
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue