Skip to content

Commit 6cd1756

Browse files
bs-thomasMarc Cámara
authored and
Marc Cámara
committed
Issue #546 - Fix issue with unable to detect routes properly when there are multiple consecutive slashes before locale. (#547)
1 parent 677526f commit 6cd1756

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Mcamara/LaravelLocalization/Middleware/LaravelLocalizationRedirectFilter.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ public function handle($request, Closure $next)
2525

2626
$currentLocale = app('laravellocalization')->getCurrentLocale();
2727
$defaultLocale = app('laravellocalization')->getDefaultLocale();
28-
$params = explode('/', $request->path());
28+
$params = explode('/', $request->getPathInfo());
29+
// Dump the first element (empty string) as getPathInfo() always returns a leading slash
30+
array_shift($params);
2931

3032
if (count($params) > 0) {
3133
$localeCode = $params[0];

0 commit comments

Comments
 (0)