aboutsummaryrefslogtreecommitdiffstats
path: root/core/Controller/UnifiedSearchController.php
diff options
context:
space:
mode:
authorJonas Meurer <jonas@freesources.org>2021-08-10 11:06:24 +0200
committerJonas Meurer <jonas@freesources.org>2021-08-16 10:56:47 +0200
commit7c76e85ddefc481fd9582560c59c4883dbd7caad (patch)
tree7c5012d53d88a725cff1b2fafebf91d2779586d0 /core/Controller/UnifiedSearchController.php
parent5f5bacde8f6f65eeaba0d1b86eb134b5527c0d54 (diff)
downloadnextcloud-server-7c76e85ddefc481fd9582560c59c4883dbd7caad.tar.gz
nextcloud-server-7c76e85ddefc481fd9582560c59c4883dbd7caad.zip
Use IURLGenerator function to get value of `\OC::$WEBROOT` global
Signed-off-by: Jonas Meurer <jonas@freesources.org>
Diffstat (limited to 'core/Controller/UnifiedSearchController.php')
-rw-r--r--core/Controller/UnifiedSearchController.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/Controller/UnifiedSearchController.php b/core/Controller/UnifiedSearchController.php
index 3836c9a6d41..bfed6d606ae 100644
--- a/core/Controller/UnifiedSearchController.php
+++ b/core/Controller/UnifiedSearchController.php
@@ -33,6 +33,7 @@ use OCP\AppFramework\OCSController;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest;
+use OCP\IURLGenerator;
use OCP\IUserSession;
use OCP\Route\IRouter;
use OCP\Search\ISearchQuery;
@@ -49,15 +50,20 @@ class UnifiedSearchController extends OCSController {
/** @var IRouter */
private $router;
+ /** @var IURLGenerator */
+ private $urlGenerator;
+
public function __construct(IRequest $request,
IUserSession $userSession,
SearchComposer $composer,
- IRouter $router) {
+ IRouter $router,
+ IURLGenerator $urlGenerator) {
parent::__construct('core', $request);
$this->composer = $composer;
$this->userSession = $userSession;
$this->router = $router;
+ $this->urlGenerator = $urlGenerator;
}
/**
@@ -127,7 +133,7 @@ class UnifiedSearchController extends OCSController {
// Optionally strip webroot from URL. Required for route matching on setups
// with Nextcloud in a webserver subfolder (webroot).
- $webroot = \OC::$WEBROOT;
+ $webroot = $this->urlGenerator->getWebroot();
if ($webroot !== '' && substr($urlPath, 0, strlen($webroot)) === $webroot) {
$urlPath = substr($urlPath, strlen($webroot));
}