diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-07-19 22:46:32 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-07-19 22:46:32 +0200 |
commit | 37a4d2bbbc651ca6838bf0049720087565fc3c87 (patch) | |
tree | 7c1b0b721ea5d35562f168e3b8cbac315d70fe10 /core/Controller | |
parent | bfc6fc8e500e02b061613c831643da2300b7fa20 (diff) | |
download | nextcloud-server-37a4d2bbbc651ca6838bf0049720087565fc3c87.tar.gz nextcloud-server-37a4d2bbbc651ca6838bf0049720087565fc3c87.zip |
Php code bump
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'core/Controller')
-rw-r--r-- | core/Controller/SvgController.php | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/core/Controller/SvgController.php b/core/Controller/SvgController.php index 03857e07c76..3d1c55d0143 100644 --- a/core/Controller/SvgController.php +++ b/core/Controller/SvgController.php @@ -30,6 +30,7 @@ use OCP\AppFramework\Http\DataDisplayResponse; use OCP\AppFramework\Http\NotFoundResponse; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Files\NotFoundException; +use OCP\App\IAppManager; use OCP\IRequest; class SvgController extends Controller { @@ -40,13 +41,18 @@ class SvgController extends Controller { /** @var ITimeFactory */ protected $timeFactory; + /** @var IAppManager */ + protected $appManager; + public function __construct(string $appName, IRequest $request, - ITimeFactory $timeFactory) { + ITimeFactory $timeFactory, + IAppManager $appManager) { parent::__construct($appName, $request); $this->serverRoot = \OC::$SERVERROOT; $this->timeFactory = $timeFactory; + $this->appManager = $appManager; } /** @@ -58,7 +64,7 @@ class SvgController extends Controller { * @param string $folder * @param string $fileName * @param string $color - * @return DataDisplayResponse|NotFoundException + * @return DataDisplayResponse|NotFoundResponse */ public function getSvgFromCore(string $folder, string $fileName, string $color = 'ffffff') { $path = $this->serverRoot . "/core/img/$folder/$fileName.svg"; @@ -74,7 +80,7 @@ class SvgController extends Controller { * @param string $app * @param string $fileName * @param string $color - * @return DataDisplayResponse|NotFoundException + * @return DataDisplayResponse|NotFoundResponse */ public function getSvgFromApp(string $app, string $fileName, string $color = 'ffffff') { @@ -83,7 +89,9 @@ class SvgController extends Controller { return $this->getSvg($path, $color, $fileName); } - $appPath = \OC_App::getAppWebPath($app); + $appRootPath = $this->appManager->getAppPath($app); + $appPath = substr($appRootPath, strlen($this->serverRoot)); + if (!$appPath) { return new NotFoundResponse(); } @@ -97,7 +105,7 @@ class SvgController extends Controller { * * @param string $path * @param string $color - * @return DataDisplayResponse|NotFoundException + * @return DataDisplayResponse|NotFoundResponse */ private function getSvg(string $path, string $color, string $fileName) { if (!file_exists($path)) { |