Commit the paths one by one to Jekyll.sanitized_path with the proper initial base.

Prevents errors like these:

[39/78] TestPost#test_: A Post processing posts should not be writable outside of destination. /Users/parker/jekyll/jekyll/test/dest
/Users/parker/jekyll/jekyll/test/dest/Users/parker/jekyll/baddie.html
 = 0.01 s
  1) Failure:
TestPost#test_: A Post processing posts should not be writable outside of destination.  [/Users/parker/jekyll/jekyll/test/test_post.rb:152]:
Failed assertion, no message given.
This commit is contained in:
Parker Moore 2014-11-03 22:26:54 -08:00
parent 2ee8d690c4
commit 90cddade53
1 changed files with 6 additions and 2 deletions

View File

@ -100,7 +100,9 @@ module Jekyll
#
# Returns a path which is prefixed with the source directory.
def in_source_dir(*paths)
Jekyll.sanitized_path(source, File.join(*paths.flatten))
paths.reduce(source) do |base, path|
Jekyll.sanitized_path(base, path)
end
end
# Public: Prefix a given path with the destination directory.
@ -110,7 +112,9 @@ module Jekyll
#
# Returns a path which is prefixed with the destination directory.
def in_dest_dir(*paths)
Jekyll.sanitized_path(dest, File.join(*paths.flatten))
paths.reduce(dest) do |base, path|
Jekyll.sanitized_path(base, path)
end
end
# The list of collections and their corresponding Jekyll::Collection instances.