mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
UnifiedSearchController: strip webroot from URL before finding a route
This should fix route matching in UnifiedSearchController on setups with Nextcloud in a subfolder (webroot). Fixes: #24144 Signed-off-by: Jonas Meurer <jonas@freesources.org>
This commit is contained in:
parent
3c6dec3061
commit
7ddfd4dbc2
1 changed files with 9 additions and 1 deletions
|
|
@ -124,9 +124,17 @@ class UnifiedSearchController extends OCSController {
|
|||
|
||||
if ($url !== '') {
|
||||
$urlParts = parse_url($url);
|
||||
$urlPath = $urlParts['path'];
|
||||
|
||||
// Optionally strip webroot from URL. Required for route matching on setups
|
||||
// with Nextcloud in a webserver subfolder (webroot).
|
||||
$webroot = \OC::$WEBROOT;
|
||||
if ($webroot !== '' && substr($urlPath, 0, strlen($webroot)) === $webroot) {
|
||||
$urlPath = substr($urlPath, strlen($webroot));
|
||||
}
|
||||
|
||||
try {
|
||||
$parameters = $this->router->findMatchingRoute($urlParts['path']);
|
||||
$parameters = $this->router->findMatchingRoute($urlPath);
|
||||
|
||||
// contacts.PageController.index => contacts.Page.index
|
||||
$route = $parameters['caller'];
|
||||
|
|
|
|||
Loading…
Reference in a new issue