Skip to content

Commit 132137d

Browse files
Merge pull request #47384 from nextcloud/backport/47380/stable29
[stable29] fix(theming): Make getImage() call save against missing non-SVG version
2 parents 4606fb2 + ef75627 commit 132137d

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

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)