Skip to content

Commit e4e4464

Browse files
fixup! fix: generate favourite icon without imagick svg support
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
1 parent a387481 commit e4e4464

File tree

5 files changed

+23
-14
lines changed

5 files changed

+23
-14
lines changed

apps/theming/lib/Controller/IconController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function getThemedIcon(string $app, string $image): Response {
8181
* Return a 32x32 favicon as png
8282
*
8383
* @param string $app ID of the app
84-
* @return DataDisplayResponse<Http::STATUS_OK, array{Content-Type: 'image/x-icon'}>|FileDisplayResponse<Http::STATUS_OK, array{Content-Type: 'image/x-icon'}>|NotFoundResponse<Http::STATUS_NOT_FOUND, array{}>
84+
* @return DataDisplayResponse<Http::STATUS_OK, array{Content-Type: 'image/png'}>|FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|NotFoundResponse<Http::STATUS_NOT_FOUND, array{}>
8585
* @throws \Exception
8686
*
8787
* 200: Favicon returned
@@ -130,7 +130,7 @@ public function getFavicon(string $app = 'core'): Response {
130130
* Return a 512x512 icon for touch devices
131131
*
132132
* @param string $app ID of the app
133-
* @return DataDisplayResponse<Http::STATUS_OK, array{Content-Type: 'image/png'}>|FileDisplayResponse<Http::STATUS_OK, array{Content-Type: 'image/x-icon'|'image/png'}>|NotFoundResponse<Http::STATUS_NOT_FOUND, array{}>
133+
* @return DataDisplayResponse<Http::STATUS_OK, array{Content-Type: 'image/png'}>|FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|NotFoundResponse<Http::STATUS_NOT_FOUND, array{}>
134134
* @throws \Exception
135135
*
136136
* 200: Touch icon returned

apps/theming/lib/Util.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ public function getAppIcon($app, $useSvg = true) {
234234
}
235235
// fallback to custom instance logo
236236
if ($this->config->getAppValue('theming', 'logoMime', '') !== '') {
237-
$logoFile = null;
238237
try {
239238
$folder = $this->appData->getFolder('global/images');
240239
return $folder->getFile('logo');
@@ -244,14 +243,10 @@ public function getAppIcon($app, $useSvg = true) {
244243
// fallback to core logo
245244
if ($useSvg) {
246245
$icon = \OC::$SERVERROOT . '/core/img/logo/logo.svg';
247-
if (file_exists($icon)) {
248-
return $icon;
249-
}
246+
return $icon;
250247
} else {
251248
$icon = \OC::$SERVERROOT . '/core/img/logo/logo.png';
252-
if (file_exists($icon)) {
253-
return $icon;
254-
}
249+
return $icon;
255250
}
256251
}
257252

apps/theming/openapi.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,13 @@
437437
"200": {
438438
"description": "Favicon returned",
439439
"content": {
440-
"image/x-icon": {
440+
"image/png": {
441+
"schema": {
442+
"type": "string",
443+
"format": "binary"
444+
}
445+
},
446+
"*/*": {
441447
"schema": {
442448
"type": "string",
443449
"format": "binary"
@@ -506,7 +512,7 @@
506512
"format": "binary"
507513
}
508514
},
509-
"image/x-icon": {
515+
"*/*": {
510516
"schema": {
511517
"type": "string",
512518
"format": "binary"

apps/theming/tests/Controller/ThemingControllerTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ public function testGetLogo(): void {
645645
$file = $this->createMock(ISimpleFile::class);
646646
$file->method('getName')->willReturn('logo.svg');
647647
$file->method('getMTime')->willReturn(42);
648+
$file->method('getMimeType')->willReturn('text/svg');
648649
$this->imageManager->expects($this->once())
649650
->method('getImage')
650651
->willReturn($file);
@@ -661,7 +662,7 @@ public function testGetLogo(): void {
661662
$csp = new ContentSecurityPolicy();
662663
$csp->allowInlineStyle();
663664
$expected->setContentSecurityPolicy($csp);
664-
@$this->assertEquals($expected, $this->themingController->getImage('logo'));
665+
@$this->assertEquals($expected, $this->themingController->getImage('logo', true));
665666
}
666667

667668

@@ -677,6 +678,7 @@ public function testGetLoginBackground(): void {
677678
$file = $this->createMock(ISimpleFile::class);
678679
$file->method('getName')->willReturn('background.png');
679680
$file->method('getMTime')->willReturn(42);
681+
$file->method('getMimeType')->willReturn('image/png');
680682
$this->imageManager->expects($this->once())
681683
->method('getImage')
682684
->willReturn($file);

openapi.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33153,7 +33153,13 @@
3315333153
"200": {
3315433154
"description": "Favicon returned",
3315533155
"content": {
33156-
"image/x-icon": {
33156+
"image/png": {
33157+
"schema": {
33158+
"type": "string",
33159+
"format": "binary"
33160+
}
33161+
},
33162+
"*/*": {
3315733163
"schema": {
3315833164
"type": "string",
3315933165
"format": "binary"
@@ -33222,7 +33228,7 @@
3322233228
"format": "binary"
3322333229
}
3322433230
},
33225-
"image/x-icon": {
33231+
"*/*": {
3322633232
"schema": {
3322733233
"type": "string",
3322833234
"format": "binary"

0 commit comments

Comments
 (0)