Upgrade to 4.4.1
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
namespace Kirby\Cms;
|
||||
|
||||
use Kirby\Filesystem\F;
|
||||
use Kirby\Toolkit\Str;
|
||||
|
||||
class LanguageRoutes
|
||||
{
|
||||
@@ -30,26 +29,9 @@ class LanguageRoutes
|
||||
'pattern' => $language->pattern(),
|
||||
'method' => 'ALL',
|
||||
'env' => 'site',
|
||||
'action' => function ($path = null) use ($kirby, $language) {
|
||||
'action' => function ($path = null) use ($language) {
|
||||
$result = $language->router()->call($path);
|
||||
|
||||
// redirect secondary-language pages that have
|
||||
// been accessed with non-translated slugs in their path
|
||||
// to their fully translated URL
|
||||
if ($path !== null && $result instanceof Page) {
|
||||
if (Str::endsWith($result->url(), $path) === false) {
|
||||
$url = $result->url();
|
||||
$query = $kirby->request()->query()->toString();
|
||||
|
||||
// preserve query across redirect
|
||||
if (empty($query) === false) {
|
||||
$url .= '?' . $query;
|
||||
}
|
||||
|
||||
return $kirby->response()->redirect($url);
|
||||
}
|
||||
}
|
||||
|
||||
// explicitly test for null as $result can
|
||||
// contain falsy values that should still be returned
|
||||
if ($result !== null) {
|
||||
|
||||
Reference in New Issue
Block a user