Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure megasplat keeps empty trailing fields
The string that a megasplat matched is split on '/'. Without setting an LIMIT for the split, empty trailing values get stripped. That is; for the route '/foo/**', the paths '/foo/bar' and '/foo/bar/' were both giving the splat as [ 'bar' ]. Or, if there were further trailing slashes in the path: '/foo/bar///a' gave ['bar','','','a'] but '/foo/bar///' gave ['bar']. How's that for inconsistent. Instead, this commit adds a (negative) limit to the split on megasplat values so that empty trailing values are kept, which allows you to join the arrayref of values together and get the original path again. The above examples are: '/foo/bar/' giving ['bar',''] '/foo/bar///a' giving ['bar','','','a'] #as before '/foo/bar///' giving ['bar','',''] This is a subtle change in behaviour, which _may_ cause some Dancers issues if they are not aware of the change. Closes #1155.
- Loading branch information