Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorJonas Meurer <jonas@freesources.org>2021-08-03 18:27:48 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2021-08-16 16:11:59 +0300
commit57e20ed566136581756a80e07995bb25f72bbcf6 (patch)
tree136ae8cc3ea11cf3492f510a43f1a7428de37803 /core
parente9fc8e1dcbdda70da77c23668b99908754602988 (diff)
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>
Diffstat (limited to 'core')
-rw-r--r--core/Controller/UnifiedSearchController.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/Controller/UnifiedSearchController.php b/core/Controller/UnifiedSearchController.php
index 93fbb323ee5..3836c9a6d41 100644
--- a/core/Controller/UnifiedSearchController.php
+++ b/core/Controller/UnifiedSearchController.php
@@ -123,9 +123,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'];