Skip to content

Commit eff60fd

Browse files
nickvergessenbackportbot[bot]
authored andcommitted
fix(theming): Make getImage() call save against missing non-SVG version
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent 629bd67 commit eff60fd

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

lib/private/Repair/RepairLogoDimension.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
namespace OC\Repair;
1010

1111
use OCA\Theming\ImageManager;
12+
use OCP\Files\NotFoundException;
13+
use OCP\Files\NotPermittedException;
1214
use OCP\IConfig;
1315
use OCP\Migration\IOutput;
1416
use OCP\Migration\IRepairStep;
@@ -44,9 +46,18 @@ public function run(IOutput $output): void {
4446
return;
4547
}
4648

47-
$simpleFile = $imageManager->getImage('logo', false);
48-
49-
$image = @imagecreatefromstring($simpleFile->getContent());
49+
try {
50+
try {
51+
$simpleFile = $imageManager->getImage('logo', false);
52+
$image = @imagecreatefromstring($simpleFile->getContent());
53+
} catch (NotFoundException|NotPermittedException) {
54+
$simpleFile = $imageManager->getImage('logo');
55+
$image = false;
56+
}
57+
} catch (NotFoundException|NotPermittedException) {
58+
$output->info('Theming is not used to provide a logo');
59+
return;
60+
}
5061

5162
$dimensions = '';
5263
if ($image !== false) {

0 commit comments

Comments
 (0)