Closed aguingand closed 1 year ago
@aguingand thanks a lot for this. Great catch about the Regex, you're of course right it might not always be .*
.
The slash encoding thing I'm going to dig into more... I see what you mean about the code, but the docs are correct in the sense that routing only works with slashes if they're in the last parameter, encoded or not. See https://github.com/laravel/framework/issues/22125 and https://symfony.com/doc/current/routing.html#slash-characters-in-route-parameters. I'm not certain whether that's relevant or matters here though since that all happens after the URL is generated. I'm going to try to add some tests here to see.
I have tested in my project, it works well with a single starting param containing slash (both laravel + ziggy). But some js tests may be relevant here.
Thanks! Gonna come back to the encoding thing separately asap.
The problem
Following up on #500. This feature is great but too restrictive:
where
regex can be different than.*
Example:
Proposed solution
I move the
/
replacement after asserting the current param matches the givenwheres
. At this point if slashes are replaced it's because the RegExp allowed so.