Handle case where canonical path should include final slash.

Add test case.