Fixed redirect with absolute language URL

This commit is contained in:
Matias Griese
2019-09-11 19:49:47 +03:00
parent 495ebcb42b
commit 52ba79f954
2 changed files with 7 additions and 3 deletions

View File

@@ -369,8 +369,11 @@ class Admin
$root = '';
}
// Check if we already have an admin path: /admin or /root/admin.
if (Utils::startsWith($redirect, $base, false) || Utils::startsWith($redirect, $root . $base, false)) {
$pattern = '|^((' . preg_quote($root, '|') . ')?\/[\w\d_-]+)' . preg_quote($base, '|') . '|ui';
// Check if we already have an admin path: /admin, /en/admin, /root/admin or /root/en/admin.
if (preg_match($pattern, $redirect)) {
$redirect = preg_replace('|^' . preg_quote($root, '|') . '|', '', $redirect);
$this->grav->redirect($redirect, $redirectCode);
}