More safety. 🔒
This commit is contained in:
parent
4078bde3ba
commit
9cbc24fce5
|
@ -29,7 +29,7 @@ module Jekyll
|
||||||
# Returns a Set with the file paths
|
# Returns a Set with the file paths
|
||||||
def existing_files
|
def existing_files
|
||||||
files = Set.new
|
files = Set.new
|
||||||
Dir.glob(File.join(site.dest, "**", "*"), File::FNM_DOTMATCH) do |file|
|
Dir.glob(site.in_dest_dir("**", "*"), File::FNM_DOTMATCH) do |file|
|
||||||
files << file unless file =~ /\/\.{1,2}$/ || file =~ keep_file_regex || keep_dirs.include?(file)
|
files << file unless file =~ /\/\.{1,2}$/ || file =~ keep_file_regex || keep_dirs.include?(file)
|
||||||
end
|
end
|
||||||
files
|
files
|
||||||
|
@ -76,7 +76,7 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns a Set with the directory paths
|
# Returns a Set with the directory paths
|
||||||
def keep_dirs
|
def keep_dirs
|
||||||
site.keep_files.map { |file| parent_dirs(File.join(site.dest, file)) }.flatten.to_set
|
site.keep_files.map { |file| parent_dirs(site.in_dest_dir(file)) }.flatten.to_set
|
||||||
end
|
end
|
||||||
|
|
||||||
# Private: Creates a regular expression from the config's keep_files array
|
# Private: Creates a regular expression from the config's keep_files array
|
||||||
|
|
|
@ -15,7 +15,7 @@ module Jekyll
|
||||||
|
|
||||||
# Get the full path to the directory containing the draft files
|
# Get the full path to the directory containing the draft files
|
||||||
def containing_dir(source, dir)
|
def containing_dir(source, dir)
|
||||||
File.join(source, dir, '_drafts')
|
Jekyll.sanitized_path(source, File.join(dir, '_drafts'))
|
||||||
end
|
end
|
||||||
|
|
||||||
# The path to the draft source file, relative to the site source
|
# The path to the draft source file, relative to the site source
|
||||||
|
|
|
@ -37,7 +37,8 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns destination file path.
|
# Returns destination file path.
|
||||||
def destination(dest)
|
def destination(dest)
|
||||||
File.join(*[dest, destination_rel_dir, @name].compact)
|
dest = site.in_dest_dir(dest)
|
||||||
|
Jekyll.sanitized_path(dest, File.join(*[destination_rel_dir, @name].compact))
|
||||||
end
|
end
|
||||||
|
|
||||||
def destination_rel_dir
|
def destination_rel_dir
|
||||||
|
|
Loading…
Reference in New Issue