summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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'];