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