From 23d79299480fe8dd6c609aebcfd0e2ba8c193039 Mon Sep 17 00:00:00 2001 From: "Heng, K. (Stephen)" Date: Fri, 26 Aug 2016 11:43:32 +0800 Subject: [PATCH] Test case for issue #5192, where Jekyll.sanitized_path strips drive name on Windows incorrectly --- test/test_path_sanitization.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/test_path_sanitization.rb b/test/test_path_sanitization.rb index a0e2f8d6..a94fc0c5 100644 --- a/test/test_path_sanitization.rb +++ b/test/test_path_sanitization.rb @@ -29,6 +29,19 @@ class TestPathSanitization < JekyllUnitTest Jekyll.sanitized_path(source_dir, "f./../../../../../../files/hi.txt") end + context "on Windows with absolute path" do + setup do + @base_path = "D:/demo" + @file_path = "D:/demo/_site" + allow(Dir).to receive(:pwd).and_return("D:/") + end + + should "strip just the clean path drive name" do + assert_equal "D:/demo/_site", + Jekyll.sanitized_path(@base_path, @file_path) + end + end + context "on Windows with file path has matching prefix" do setup do @base_path = "D:/site"