Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-04-27 11:58:34 +0300
committerGitHub <noreply@github.com>2020-04-27 11:58:34 +0300
commit9b7e24a7a1c1059c7f2a0568b2d5c29f512618f8 (patch)
tree423ff5692fa16e047b2a8a608d6b1e27ea64d613 /core/Controller
parent3c5c4caa4da7fee700ba683bb75e3b8aa7c1b190 (diff)
parentd766d09f01314c5db7dc54288884edb6a159321e (diff)
Merge pull request #19084 from nextcloud/bug/13556/wrong-paths-for-svg
Make it possible to resolve svg's outside \OC::$SERVERROOT
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);
}