From 067f8b6be7d68f4688b217ef00184e37a1f47aff Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 8 Nov 2014 13:10:28 -0800 Subject: [PATCH] Strip the drive name from both paths when checking the prefix. --- lib/jekyll.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 137d5894..ce94b64b 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -141,9 +141,12 @@ module Jekyll # # Returns the sanitized path. def sanitized_path(base_directory, questionable_path) + return base_directory if base_directory.eql?(questionable_path) + clean_path = File.expand_path(questionable_path, "/") - clean_path.gsub!(/\A\w\:\//, '/') - unless clean_path.start_with?(base_directory) + clean_path = clean_path.sub(/^\A\w\:\//, '/') + + unless clean_path.start_with?(base_directory.sub(/^\A\w\:\//, '/')) File.join(base_directory, clean_path) else clean_path