jekyll/jekyll — pull request #3108 by ribbons (2014-11-14 21:19:25+00:00)
Title: Fix path case change in sanitized_path method on Windows

Under Windows the use of `File.expand_path` can change the case of the path being sanitized if the given path exists and is a different case. The way it is called in the `sanitize_path` method in Jekyll can cause a case change between the source and generated sites if there is a file or folder with the same name (but different case) in the root of the drive containing the working directory.

I discovered this bug as I have a folder called `Projects` in the root of the drive I also store the source for my Jekyll sites in, one of which has a sub-folder called `projects` which is then hosted under httpd on linux (e.g. case sensitive). Certainly left me scratching my head for a bit...

This commit replaces the call to `expand_path` in `sanitize_path` with regular expressions to achieve the same result without the side effect of a possible case change.

This also adds extra tests to ensure that `sanitize_path` is working as intended and for the case change behaviour under Windows.