From c7adcb85aefc384a59c6081015537a603a675c3e Mon Sep 17 00:00:00 2001 From: Julius Haertl Date: Sun, 14 Aug 2016 12:53:16 +0200 Subject: [PATCH] Theming: Fix default parameters in icon routes Signed-off-by: Julius Haertl --- apps/theming/appinfo/routes.php | 1 - apps/theming/lib/Controller/IconController.php | 4 ++-- lib/private/URLGenerator.php | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/theming/appinfo/routes.php b/apps/theming/appinfo/routes.php index a6511668d14..a8436ab254f 100644 --- a/apps/theming/appinfo/routes.php +++ b/apps/theming/appinfo/routes.php @@ -76,7 +76,6 @@ return ['routes' => [ 'name' => 'Icon#getThemedIcon', 'url' => '/img/{app}/{image}', 'verb' => 'GET', - 'defaults' => array("app" => "core"), 'requirements' => array('image' => '.+') ], ]]; diff --git a/apps/theming/lib/Controller/IconController.php b/apps/theming/lib/Controller/IconController.php index 7ceaa599232..6e51f10c4cc 100644 --- a/apps/theming/lib/Controller/IconController.php +++ b/apps/theming/lib/Controller/IconController.php @@ -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); diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php index 8972f1602e3..f8b79dedd8e 100644 --- a/lib/private/URLGenerator.php +++ b/lib/private/URLGenerator.php @@ -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"; -- 2.39.5