mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
inform that symlinks are not allowed in safe mode (#6670)
Merge pull request 6670
This commit is contained in:
committed by
jekyllbot
parent
f77d704a1b
commit
082e0623af
@@ -115,9 +115,7 @@ MSG
|
||||
path = File.join(dir.to_s, file.to_s)
|
||||
return path if valid_include_file?(path, dir.to_s, safe)
|
||||
end
|
||||
raise IOError, "Could not locate the included file '#{file}' in any of "\
|
||||
"#{includes_dirs}. Ensure it exists in one of those directories and, "\
|
||||
"if it is a symlink, does not point outside your site source."
|
||||
raise IOError, could_not_locate_message(file, includes_dirs, safe)
|
||||
end
|
||||
|
||||
def render(context)
|
||||
@@ -192,6 +190,18 @@ MSG
|
||||
def read_file(file, context)
|
||||
File.read(file, file_read_opts(context))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def could_not_locate_message(file, includes_dirs, safe)
|
||||
message = "Could not locate the included file '#{file}' in any of "\
|
||||
"#{includes_dirs}. Ensure it exists in one of those directories and"
|
||||
message + if safe
|
||||
" is not a symlink as those are not allowed in safe mode."
|
||||
else
|
||||
", if it is a symlink, does not point outside your site source."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class IncludeRelativeTag < IncludeTag
|
||||
|
||||
Reference in New Issue
Block a user