Fix redirect bug when changing admin route to admin-*

This commit is contained in:
Andy Miller
2018-03-14 14:46:34 -06:00
parent b3bc6fb877
commit 0930dabe1f
2 changed files with 3 additions and 1 deletions

View File

@@ -779,7 +779,7 @@ class AdminPlugin extends Plugin
// Special case to redirect after changing the admin route to avoid 'breaking'
$obj = $event['object'];
if (isset($obj->route) && $this->admin_route !== $obj->route) {
$redirect = str_replace($this->admin_route, $obj->route, $this->uri->path() );
$redirect = preg_replace('/^' . str_replace('/','\/',$this->admin_route) . '/',$obj->route,$this->uri->path());
$this->grav->redirect($redirect);
}
}