Fix non file paths

Fixed from previous request -- the issue was that matches with a final path separator (e.g. `folder/`) would cause failure.