mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-06 13:25:46 +01:00
Fixed redirect with absolute language URL
This commit is contained in:
@@ -5,7 +5,8 @@
|
|||||||
* Add ability to Sanitize SVGs on file upload
|
* Add ability to Sanitize SVGs on file upload
|
||||||
* Add ability to Sanitize SVGs in Page media
|
* Add ability to Sanitize SVGs in Page media
|
||||||
1. [](#bugfix)
|
1. [](#bugfix)
|
||||||
* Keep language setting for AJAX requests
|
* Fixed missing language for AJAX requests
|
||||||
|
* Fixed redirect with absolute language URL
|
||||||
|
|
||||||
# v1.10.0-beta.7
|
# v1.10.0-beta.7
|
||||||
## 08/30/2019
|
## 08/30/2019
|
||||||
|
|||||||
@@ -369,8 +369,11 @@ class Admin
|
|||||||
$root = '';
|
$root = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we already have an admin path: /admin or /root/admin.
|
$pattern = '|^((' . preg_quote($root, '|') . ')?\/[\w\d_-]+)' . preg_quote($base, '|') . '|ui';
|
||||||
if (Utils::startsWith($redirect, $base, false) || Utils::startsWith($redirect, $root . $base, false)) {
|
// 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);
|
$this->grav->redirect($redirect, $redirectCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user