mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-05 04:46:03 +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 in Page media
|
||||
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
|
||||
## 08/30/2019
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user