gollum/gollum-lib — pull request #20 by jamieoliver (2013-05-29 18:49:33+00:00)
Title: Fix bug when renaming a page to a subdirectory containing spaces

This PR fixes a bug where renaming a page to a subdirectory containing spaces would not work correctly. For example renaming `A/C` to `A B/C` would update the repo but the front end would not redirect to the new page.

The fix has been achieved by generally improving the handling of subdirectories containing spaces in `Gollum::Page#find_page_in_tree` by treating the subdirectory and page name as one. I have renamed `filename` to `path` in `Gollum::Page#page_match` to highlight that this method will work on all paths, not just filenames.

I added a few tests for renames with various parts of the path containing spaces. Two of the tests will fail without the fix whereas the remainder will pass regardless. This is because the existing code supports spaces in the page name but not subdirectories.

I'd appreciate a code review before merging this, hence the PR. Hopefully this is a small step towards #11.