mcamara / laravel-localization

Easy localization for Laravel
MIT License
3.36k stars 510 forks source link

Specifying multiple slashes in URL "after domain" and "before the locale" should redirect, but instead, it ignores the slashes and loads the route. #546

Open bs-thomas opened 6 years ago

bs-thomas commented 6 years ago

Actual Behavior (a) http://www.somedomain.com/en/some/path This loads the route "some/path/" (handled by Laravel)

(b) http://www.somedomain.com///en/some/path This ALSO loads the route "some/path/" (handled by Laravel)

Expected Behavior (a) http://www.somedomain.com/en/some/path This should load the route "/some/path/" (handled by Laravel)

(b) http://www.somedomain.com///en/some/path This should get redirected to http://www.somedomain.com/en//en/some/path, (handled by laravel-localization) and then load the route "//en/some/path" (handled by Laravel)

I am working on a fix, will send a Pull Request shortly.

bs-thomas commented 6 years ago

Btw I also noticed that the tests do not include this case yet.

But I'm not quite sure how the unit test works. Tried looking, but couldnt quickly understand and underght schedule.

Would any kind person be able to add this test in? Thanks a bunch!!

bs-thomas commented 6 years ago

@mcamara Nice, thanks for the merge! Btw, do we not need any unit tests? Notice I haven't included them.