Prevent _includes dir from being a symlink.
This commit is contained in:
parent
61acd47ed2
commit
3ab016870d
|
@ -9,6 +9,7 @@
|
||||||
* Bug Fixes
|
* Bug Fixes
|
||||||
* Fixed filename basename generation (#208)
|
* Fixed filename basename generation (#208)
|
||||||
* Set mode to UTF8 on Sequel connections (#237)
|
* Set mode to UTF8 on Sequel connections (#237)
|
||||||
|
* Prevent _includes dir from being a symlink
|
||||||
|
|
||||||
== 0.7.0 / 2010-08-24
|
== 0.7.0 / 2010-08-24
|
||||||
* Minor Enhancements
|
* Minor Enhancements
|
||||||
|
|
|
@ -7,11 +7,17 @@ module Jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
def render(context)
|
def render(context)
|
||||||
|
includes_dir = File.join(context.registers[:site].source, '_includes')
|
||||||
|
|
||||||
|
if File.symlink?(includes_dir)
|
||||||
|
return "Includes directory '#{includes_dir}' cannot be a symlink"
|
||||||
|
end
|
||||||
|
|
||||||
if @file !~ /^[a-zA-Z0-9_\/\.-]+$/ || @file =~ /\.\// || @file =~ /\/\./
|
if @file !~ /^[a-zA-Z0-9_\/\.-]+$/ || @file =~ /\.\// || @file =~ /\/\./
|
||||||
return "Include file '#{@file}' contains invalid characters or sequences"
|
return "Include file '#{@file}' contains invalid characters or sequences"
|
||||||
end
|
end
|
||||||
|
|
||||||
Dir.chdir(File.join(context.registers[:site].source, '_includes')) do
|
Dir.chdir(includes_dir) do
|
||||||
choices = Dir['**/*'].reject { |x| File.symlink?(x) }
|
choices = Dir['**/*'].reject { |x| File.symlink?(x) }
|
||||||
if choices.include?(@file)
|
if choices.include?(@file)
|
||||||
source = File.read(@file)
|
source = File.read(@file)
|
||||||
|
|
Loading…
Reference in New Issue