summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/Controller/SvgController.php18
-rw-r--r--lib/private/Template/IconsCacher.php1
-rw-r--r--tests/lib/Template/IconsCacherTest.php1
3 files changed, 15 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)) {
diff --git a/lib/private/Template/IconsCacher.php b/lib/private/Template/IconsCacher.php
index 5e5e0fda50b..c262d26654f 100644
--- a/lib/private/Template/IconsCacher.php
+++ b/lib/private/Template/IconsCacher.php
@@ -1,4 +1,5 @@
<?php
+declare (strict_types = 1);
/**
* @copyright Copyright (c) 2018, John Molakvoæ (skjnldsv@protonmail.com)
*
diff --git a/tests/lib/Template/IconsCacherTest.php b/tests/lib/Template/IconsCacherTest.php
index 769d7f1893d..106f08d5fa8 100644
--- a/tests/lib/Template/IconsCacherTest.php
+++ b/tests/lib/Template/IconsCacherTest.php
@@ -1,4 +1,5 @@
<?php
+declare (strict_types = 1);
/**
* @copyright Copyright (c) 2018, John Molakvoæ (skjnldsv@protonmail.com)
*