-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[Bug] urlencoded slashes in routing parameters #4338
Conversation
the raw urlencode on full path did not allow encoded slashes in the url parameters
encode the parameters when creating routes, not the full url! allows slashes in parameters
allow parsing the parameters out of route before decoding. this will allow encoded slashes in the parameters.
did not mean to remove the new force route.
$route = new Illuminate\Routing\Route(array('GET'), 'foo/bar/åαф/{baz}', array('as' => 'foobarbaz')); |
Honestly this is kind of hack for your use case. Just don't use slashes in the URLs. Use something else. |
mind if I finish my request before you close this? |
how is this a hack to allow valid urlencoded characters? |
Thank you for your support :) |
Strange solution Taylor. We need for autoencoding router parameters. |
Agreed pilot! (artistan/urlencode) [https://github.com/Artistan/Urlencode] [https://packagist.org/packages/artistan/urlencode] Basically all it overrides in routing is to explode the url before unencoding the parameters. |
The regex Symfony uses for parts of a path is |
This is still broken and makes passing base64 encoded data in the URL impossible in Laravel. For the 80% use case indeed. |
@taylorotwell stated "Just don't use slashes in the URLs. " -- LMAO. |
basically it decodes the path BEFORE splitting it into parameters and that is why encoded slashes affect the parameters. |
@panzer-planet While I'd really like to see this fixed, why wouldn't base64 work? URL encoding uses % and base 64 doesn't? So there's no way a base64 string would produce a %2F. If I'm missing something, let me know and I'll update the issue I just created. Might as well spam them with another issue since they're ignoring this one. Cause this is literally retarded. There is NO reason laravel should be urldecoding the URL before you do routing. |
@csga5000 It's not because base64 uses |
@ameenross Oh, right, I figured I was missing something. Thanks |
You're welcome. Also of interest: alternative base64 encoding, [A-Za-z0-9-_] more suited for URLs: https://tools.ietf.org/html/rfc4648#page-7 |
@csga5000 and @Artistan I changed the Artistan/Urlencode to work on Laravel 5. You can get it here https://github.com/alcaitiff/laravel-urlencode |
Routing
Current routes do not allow for urlencoded slashes in the paths. This is problematic when trying to create ecommerce solutions with partnumbers in the routes since many part numbers have slashes in them. There are also quite a few manufacturers with slashes in their names and or brands. This commit provides the functionality to allow an uri to have encoded slashes, and other characters, in the routes and also to create routes with those parameters. An example url may be...
https://stage.test.com/part/Cisco%20Systems%2C%20Inc/CISCO2851-SRST%2FK9
thank you!