Fix problem where entries weren't stripped of their trailing slashes.
This commit is contained in:
parent
179b5ab193
commit
817f6cb658
|
|
@ -55,8 +55,9 @@ module Jekyll
|
||||||
# relative to the collection's directory
|
# relative to the collection's directory
|
||||||
def entries
|
def entries
|
||||||
return Array.new unless exists?
|
return Array.new unless exists?
|
||||||
|
@entries ||=
|
||||||
Dir.glob(collection_dir("**", "*.*")).map do |entry|
|
Dir.glob(collection_dir("**", "*.*")).map do |entry|
|
||||||
entry[collection_dir("")] = ''; entry
|
entry["#{collection_dir}/"] = ''; entry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -66,8 +67,12 @@ module Jekyll
|
||||||
# Returns a list of filtered entry paths.
|
# Returns a list of filtered entry paths.
|
||||||
def filtered_entries
|
def filtered_entries
|
||||||
return Array.new unless exists?
|
return Array.new unless exists?
|
||||||
|
@filtered_entries ||=
|
||||||
Dir.chdir(directory) do
|
Dir.chdir(directory) do
|
||||||
entry_filter.filter(entries).reject { |f| File.directory?(f) }
|
entry_filter.filter(entries).reject do |f|
|
||||||
|
path = collection_dir(f)
|
||||||
|
File.directory?(path) || (File.symlink?(f) && site.safe)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -187,6 +187,7 @@ class TestCollections < Test::Unit::TestCase
|
||||||
|
|
||||||
should "not allow symlinks" do
|
should "not allow symlinks" do
|
||||||
assert_not_include @collection.filtered_entries, "um_hi.md"
|
assert_not_include @collection.filtered_entries, "um_hi.md"
|
||||||
|
assert_not_include @collection.filtered_entries, "/um_hi.md"
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not include the symlinked file in the list of docs" do
|
should "not include the symlinked file in the list of docs" do
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue