From 90cddade532a6ca1c24e4349d45d48aa46b2515a Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 3 Nov 2014 22:26:54 -0800 Subject: [PATCH] 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. --- lib/jekyll/site.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 2f639a10..115b4133 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -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.