-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NotFoundHttpException if route parameters are 'encoded' #261
Comments
Hi @jatubio . I will make some unit tests and see what I can do about the issue you are experiencing. Until then you might be able to create your own workaround by defining your own regular expression for the parameters. By default the library uses only Please refer to the "Custom regex for matching parameters" section in the documentation for further information: I think something like this could work (haven't tested): I'll keep you posted when I've got further info. / Simon |
Hi @skipperbent. I have tested the url Maybe this can help you:
But, it's not a complete solution because Simon, Thank you for your time. PS: If you think that it's too much work to solve this issue, I can change my code easily |
Hi @jatubio . Can you please try this regular expression the affected routes? SimpleRouter::get('cursos/listado/{listado?}/{filtro?}', $callback, ['defaultParameterRegex' => '[\w\p{L}\s-]+']); No worries - I always appreciate feedback which helps improve the project, so keep em' coming 👍 Let me know if the above works. / Simon |
Copy-pasta of passing unit-test: public function testUnicodeCharacters()
{
TestRouter::get('/cursos/listado/{listado?}/{category?}', 'DummyController@method1', ['defaultParameterRegex' => '[\w\p{L}\s-]+']);
TestRouter::get('/kategori/økse', 'DummyController@method1', ['defaultParameterRegex' => '[\w\ø]+']);
TestRouter::debugNoReset('/cursos/listado/especialidad/cirugía local', 'get');
$this->assertEquals('/cursos/listado/{listado?}/{category?}/', TestRouter::router()->getRequest()->getLoadedRoute()->getUrl());
TestRouter::debugNoReset('/kategori/økse', 'get');
$this->assertEquals('/kategori/økse/', TestRouter::router()->getRequest()->getLoadedRoute()->getUrl());
TestRouter::router()->reset();
} |
Thank you @skipperbent, it works like a charm! :) |
I'm glad to hear. I'll close this issue. / Simon |
Hi Simon,
I'm using your library on one spanish web site.
For the route:
/especialidad/{especialidad}
Sometimes i have one url like:
/especialidad/cirugía local
.I have encoded the url and final url is:
/especialidad/cirug%C3%ADa%20local
, but i get NotFoundHttpException with this url.In summary:
This works:
/especialidad/cirugia
This don't work:
/especialidad/cirug%C3%ADa (/especialidad/cirugía)
/especialidad/cirug%C3%ADa%20local (/especialidad/cirugía local)
Thank you
The text was updated successfully, but these errors were encountered: