Skip to content

Commit

Permalink
disallow symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
mojombo committed Aug 24, 2009
1 parent e8e8f64 commit 0dfb486
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/jekyll/site.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,15 @@ def transform_pages(dir = '')
base = File.join(self.source, dir)
entries = filter_entries(Dir.entries(base))
directories = entries.select { |e| File.directory?(File.join(base, e)) }
files = entries.reject { |e| File.directory?(File.join(base, e)) }
files = entries.reject { |e| File.directory?(File.join(base, e)) || File.symlink?(File.join(base, e)) }

# we need to make sure to process _posts *first* otherwise they
# might not be available yet to other templates as {{ site.posts }}
if directories.include?('_posts')
directories.delete('_posts')
read_posts(dir)
end

[directories, files].each do |entries|
entries.each do |f|
if File.directory?(File.join(base, f))
Expand All @@ -187,7 +187,6 @@ def transform_pages(dir = '')
paginate_posts(f, dir)
else
first3 = File.open(File.join(self.source, dir, f)) { |fd| fd.read(3) }

if first3 == "---"
# file appears to have a YAML header so process it as a page
page = Page.new(self, self.source, dir, f)
Expand Down

0 comments on commit 0dfb486

Please sign in to comment.