From 52870c07d7407eefe31ea80347c80e9a66583af9 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sun, 3 Jul 2016 06:09:58 +0200 Subject: [PATCH 1/4] Fix endless recursion and make sure we stay in site.dest On Windows parent_dir can be 'd:/' causing an endless recursion. Signed-off-by: Sven Strickroth --- lib/jekyll-multisite.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll-multisite.rb b/lib/jekyll-multisite.rb index 943fea1..f0f5b4e 100644 --- a/lib/jekyll-multisite.rb +++ b/lib/jekyll-multisite.rb @@ -46,7 +46,7 @@ def sanitized_path(base_directory, questionable_path) class Cleaner def parent_dirs(file) parent_dir = File.dirname(file) - if parent_dir == '/' + if parent_dir == '/' or File.dirname(parent_dir) == parent_dir or !parent_dir.start_with?(site.dest) [] elsif parent_dir == site.dest [] From 5b3dc16f46aeb618030140391ec015251a3e701e Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sun, 3 Jul 2016 06:13:29 +0200 Subject: [PATCH 2/4] Make sure we stay in the site folder If a subfolder A of a site folder is named like a folder B in the root (/), then the folder B is taken instead of A. Signed-off-by: Sven Strickroth --- lib/jekyll-multisite.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll-multisite.rb b/lib/jekyll-multisite.rb index f0f5b4e..d1153e1 100644 --- a/lib/jekyll-multisite.rb +++ b/lib/jekyll-multisite.rb @@ -34,7 +34,7 @@ def sanitized_path(base_directory, questionable_path) base_directory elsif questionable_path.start_with?(base_directory) questionable_path - elsif File.exists?(questionable_path) and questionable_path != '/' + elsif File.exists?(questionable_path) and !questionable_path.start_with?('/') File.expand_path(questionable_path) else File.join(base_directory, questionable_path) From 5e02e20b94ff0f3a0f9a320e3c8718bccdec9c5f Mon Sep 17 00:00:00 2001 From: csware Date: Tue, 12 Jul 2016 07:41:44 +0200 Subject: [PATCH 3/4] jekyll-multisite requires jekyll-paginate --- jekyll-multisite.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/jekyll-multisite.gemspec b/jekyll-multisite.gemspec index 9b03c74..3e52935 100644 --- a/jekyll-multisite.gemspec +++ b/jekyll-multisite.gemspec @@ -11,4 +11,5 @@ Gem::Specification.new do |s| s.license = 'GPL-3.0' s.files = ['lib/jekyll-multisite.rb'] s.add_runtime_dependency 'jekyll', '~> 3.0', '>= 3.0.1' + s.add_runtime_dependency 'jekyll-paginate', '~> 1.1.0' end From a822ff417d0203a2df78039a8c06f1eb0b8b42ae Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Tue, 28 Apr 2020 22:33:05 +0200 Subject: [PATCH 4/4] Make work on *nix and Windows Fixes a regression introduced in commit 5b3dc16f46aeb618030140391ec015251a3e701e. Signed-off-by: Sven Strickroth --- lib/jekyll-multisite.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/jekyll-multisite.rb b/lib/jekyll-multisite.rb index d1153e1..c4daa21 100644 --- a/lib/jekyll-multisite.rb +++ b/lib/jekyll-multisite.rb @@ -34,7 +34,9 @@ def sanitized_path(base_directory, questionable_path) base_directory elsif questionable_path.start_with?(base_directory) questionable_path - elsif File.exists?(questionable_path) and !questionable_path.start_with?('/') + elsif File.exists?(questionable_path) and !questionable_path.start_with?('/') and (ENV['OS'] == 'Windows_NT') + File.expand_path(questionable_path) + elsif File.exists?(questionable_path) and questionable_path != '/' and !(ENV['OS'] == 'Windows_NT') File.expand_path(questionable_path) else File.join(base_directory, questionable_path)