Theming: Fix default parameters in icon routes
Signed-off-by: Julius Haertl <jus@bitgrid.net>
This commit is contained in:
parent
64510bd87a
commit
c7adcb85ae
|
@ -76,7 +76,6 @@ return ['routes' => [
|
||||||
'name' => 'Icon#getThemedIcon',
|
'name' => 'Icon#getThemedIcon',
|
||||||
'url' => '/img/{app}/{image}',
|
'url' => '/img/{app}/{image}',
|
||||||
'verb' => 'GET',
|
'verb' => 'GET',
|
||||||
'defaults' => array("app" => "core"),
|
|
||||||
'requirements' => array('image' => '.+')
|
'requirements' => array('image' => '.+')
|
||||||
],
|
],
|
||||||
]];
|
]];
|
||||||
|
|
|
@ -109,7 +109,7 @@ class IconController extends Controller {
|
||||||
* @param $app app name
|
* @param $app app name
|
||||||
* @return StreamResponse|DataResponse
|
* @return StreamResponse|DataResponse
|
||||||
*/
|
*/
|
||||||
public function getFavicon($app) {
|
public function getFavicon($app="core") {
|
||||||
// TODO: we need caching here
|
// TODO: we need caching here
|
||||||
$icon = $this->renderAppIcon($app);
|
$icon = $this->renderAppIcon($app);
|
||||||
$icon->resizeImage(32, 32, Imagick::FILTER_LANCZOS, 1);
|
$icon->resizeImage(32, 32, Imagick::FILTER_LANCZOS, 1);
|
||||||
|
@ -130,7 +130,7 @@ class IconController extends Controller {
|
||||||
* @param $app app name
|
* @param $app app name
|
||||||
* @return StreamResponse|DataResponse
|
* @return StreamResponse|DataResponse
|
||||||
*/
|
*/
|
||||||
public function getTouchIcon($app) {
|
public function getTouchIcon($app="core") {
|
||||||
// TODO: we need caching here
|
// TODO: we need caching here
|
||||||
$icon = $this->renderAppIcon($app);
|
$icon = $this->renderAppIcon($app);
|
||||||
$icon->resizeImage(512, 512, Imagick::FILTER_LANCZOS, 1);
|
$icon->resizeImage(512, 512, Imagick::FILTER_LANCZOS, 1);
|
||||||
|
|
|
@ -158,8 +158,10 @@ class URLGenerator implements IURLGenerator {
|
||||||
// Check if the app is in the app folder
|
// Check if the app is in the app folder
|
||||||
$path = '';
|
$path = '';
|
||||||
if(\OCP\App::isEnabled('theming') && $image === "favicon.ico") {
|
if(\OCP\App::isEnabled('theming') && $image === "favicon.ico") {
|
||||||
|
if($app==="") { $app = "core"; }
|
||||||
$path = $this->linkToRoute('theming.Icon.getFavicon', [ 'app' => $app ]);
|
$path = $this->linkToRoute('theming.Icon.getFavicon', [ 'app' => $app ]);
|
||||||
} elseif(\OCP\App::isEnabled('theming') && $image === "favicon-touch.png") {
|
} elseif(\OCP\App::isEnabled('theming') && $image === "favicon-touch.png") {
|
||||||
|
if($app==="") { $app = "core"; }
|
||||||
$path = $this->linkToRoute('theming.Icon.getTouchIcon', [ 'app' => $app ]);
|
$path = $this->linkToRoute('theming.Icon.getTouchIcon', [ 'app' => $app ]);
|
||||||
} elseif (file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$image")) {
|
} elseif (file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$image")) {
|
||||||
$path = \OC::$WEBROOT . "/themes/$theme/apps/$app/img/$image";
|
$path = \OC::$WEBROOT . "/themes/$theme/apps/$app/img/$image";
|
||||||
|
|
Loading…
Reference in New Issue