summaryrefslogtreecommitdiffstats
path: root/core/Controller
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2020-01-22 21:13:36 +0100
committerDaniel Kesselberg <mail@danielkesselberg.de>2020-04-24 16:19:10 +0200
commit72a16b17792e2a5353cc0ffce8fc24ed4ff1351c (patch)
treeb5dbe4e87f6ce4950859f8660bd4b7feceb16775 /core/Controller
parent84a35361599640d838815a4127eab58e49f052fc (diff)
downloadnextcloud-server-72a16b17792e2a5353cc0ffce8fc24ed4ff1351c.tar.gz
nextcloud-server-72a16b17792e2a5353cc0ffce8fc24ed4ff1351c.zip
Make it possible to resolve svg for apps_paths outside the document root
Previous implementation assumes the app path is always a child \OC::$SERVERROOT. That's not always true. Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'core/Controller')
-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);
}