Fix problem where entries weren't stripped of their trailing slashes.

This commit is contained in:
Parker Moore 2014-10-20 21:57:15 -07:00
parent 179b5ab193
commit 817f6cb658
2 changed files with 12 additions and 6 deletions

View File

@ -55,9 +55,10 @@ module Jekyll
# relative to the collection's directory
def entries
return Array.new unless exists?
Dir.glob(collection_dir("**", "*.*")).map do |entry|
entry[collection_dir("")] = ''; entry
end
@entries ||=
Dir.glob(collection_dir("**", "*.*")).map do |entry|
entry["#{collection_dir}/"] = ''; entry
end
end
# Filtered version of the entries in this collection.
@ -66,9 +67,13 @@ module Jekyll
# Returns a list of filtered entry paths.
def filtered_entries
return Array.new unless exists?
Dir.chdir(directory) do
entry_filter.filter(entries).reject { |f| File.directory?(f) }
end
@filtered_entries ||=
Dir.chdir(directory) do
entry_filter.filter(entries).reject do |f|
path = collection_dir(f)
File.directory?(path) || (File.symlink?(f) && site.safe)
end
end
end
# The directory for this Collection, relative to the site source.

View File

@ -187,6 +187,7 @@ class TestCollections < Test::Unit::TestCase
should "not allow symlinks" do
assert_not_include @collection.filtered_entries, "um_hi.md"
assert_not_include @collection.filtered_entries, "/um_hi.md"
end
should "not include the symlinked file in the list of docs" do