]> source.dussan.org Git - nextcloud-server.git/commitdiff
Theming: Fix default parameters in icon routes
authorJulius Haertl <jus@bitgrid.net>
Sun, 14 Aug 2016 10:53:16 +0000 (12:53 +0200)
committerJulius Haertl <jus@bitgrid.net>
Fri, 18 Nov 2016 09:23:23 +0000 (10:23 +0100)
Signed-off-by: Julius Haertl <jus@bitgrid.net>
apps/theming/appinfo/routes.php
apps/theming/lib/Controller/IconController.php
lib/private/URLGenerator.php

index a6511668d1424e509b9413dd41ac3ecf4b96c194..a8436ab254fcd6185994ab383c57ac48b25a16d0 100644 (file)
@@ -76,7 +76,6 @@ return ['routes' => [
                'name'  => 'Icon#getThemedIcon',
                'url' => '/img/{app}/{image}',
                'verb' => 'GET',
-               'defaults' => array("app" => "core"),
                'requirements' => array('image' => '.+')
        ],
 ]];
index 7ceaa59923258755775ce26dd56b13c8cd69e70e..6e51f10c4ccb7b8d136927c3d8b6635995227222 100644 (file)
@@ -109,7 +109,7 @@ class IconController extends Controller {
         * @param $app app name
         * @return StreamResponse|DataResponse
         */
-       public function getFavicon($app) {
+       public function getFavicon($app="core") {
                // TODO: we need caching here
                $icon = $this->renderAppIcon($app);
                $icon->resizeImage(32, 32, Imagick::FILTER_LANCZOS, 1);
@@ -130,7 +130,7 @@ class IconController extends Controller {
         * @param $app app name
         * @return StreamResponse|DataResponse
         */
-       public function getTouchIcon($app) {
+       public function getTouchIcon($app="core") {
                // TODO: we need caching here
                $icon = $this->renderAppIcon($app);
                $icon->resizeImage(512, 512, Imagick::FILTER_LANCZOS, 1);
index 8972f1602e3266388dbe8e2ee34bcc40713a60cf..f8b79dedd8ec4081c36bf476dd8b0a93b5e32a9c 100644 (file)
@@ -158,8 +158,10 @@ class URLGenerator implements IURLGenerator {
                // Check if the app is in the app folder
                $path = '';
                if(\OCP\App::isEnabled('theming') && $image === "favicon.ico") {
+                       if($app==="") { $app = "core"; }
                        $path = $this->linkToRoute('theming.Icon.getFavicon', [ 'app' => $app ]);
                } elseif(\OCP\App::isEnabled('theming') && $image === "favicon-touch.png") {
+                       if($app==="") { $app = "core"; }
                        $path = $this->linkToRoute('theming.Icon.getTouchIcon', [ 'app' => $app ]);
                } elseif (file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$image")) {
                        $path = \OC::$WEBROOT . "/themes/$theme/apps/$app/img/$image";