diff options
author | Jonas Meurer <jonas@freesources.org> | 2021-08-10 11:06:24 +0200 |
---|---|---|
committer | Jonas Meurer <jonas@freesources.org> | 2021-08-16 10:56:47 +0200 |
commit | 7c76e85ddefc481fd9582560c59c4883dbd7caad (patch) | |
tree | 7c5012d53d88a725cff1b2fafebf91d2779586d0 /core/Controller/UnifiedSearchController.php | |
parent | 5f5bacde8f6f65eeaba0d1b86eb134b5527c0d54 (diff) | |
download | nextcloud-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.php | 10 |
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)); } |