Use Jekyll.sanitized_path more.

This commit is contained in:
Parker Moore 2014-07-01 18:29:15 -04:00
parent 05f1fac2a7
commit a66d96ce0a
2 changed files with 3 additions and 3 deletions

View File

@ -43,7 +43,7 @@ module Jekyll
# Returns nothing. # Returns nothing.
def read_yaml(base, name, opts = {}) def read_yaml(base, name, opts = {})
begin begin
self.content = File.read(File.join(base, name), self.content = File.read(Jekyll.sanitized_path(base, name),
merged_file_read_opts(opts)) merged_file_read_opts(opts))
if content =~ /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m if content =~ /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m
self.content = $POSTMATCH self.content = $POSTMATCH

View File

@ -195,7 +195,7 @@ module Jekyll
# #
# Returns nothing # Returns nothing
def read_data(dir) def read_data(dir)
base = File.join(source, dir) base = Jekyll.sanitized_path(source, dir)
read_data_to(base, self.data) read_data_to(base, self.data)
end end
@ -214,7 +214,7 @@ module Jekyll
end end
entries.each do |entry| entries.each do |entry|
path = File.join(dir, entry) path = Jekyll.sanitized_path(dir, entry)
next if File.symlink?(path) && safe next if File.symlink?(path) && safe
key = sanitize_filename(File.basename(entry, '.*')) key = sanitize_filename(File.basename(entry, '.*'))