aboutsummaryrefslogtreecommitdiffstats
path: root/core/Controller/SvgController.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/Controller/SvgController.php')
-rw-r--r--core/Controller/SvgController.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/core/Controller/SvgController.php b/core/Controller/SvgController.php
index ba0e77602f2..af71ca17330 100644
--- a/core/Controller/SvgController.php
+++ b/core/Controller/SvgController.php
@@ -32,6 +32,7 @@ declare(strict_types=1);
namespace OC\Core\Controller;
use OC\Template\IconsCacher;
+use OCP\App\AppPathNotFoundException;
use OCP\App\IAppManager;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
@@ -97,13 +98,13 @@ class SvgController extends Controller {
* @return DataDisplayResponse|NotFoundResponse
*/
public function getSvgFromApp(string $app, string $fileName, string $color = 'ffffff') {
- $appRootPath = $this->appManager->getAppPath($app);
- $appPath = substr($appRootPath, strlen($this->serverRoot));
-
- if (!$appPath) {
+ try {
+ $appPath = $this->appManager->getAppPath($app);
+ } catch (AppPathNotFoundException $e) {
return new NotFoundResponse();
}
- $path = $this->serverRoot . $appPath ."/img/$fileName.svg";
+
+ $path = $appPath . "/img/$fileName.svg";
return $this->getSvg($path, $color, $fileName);
}