]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(theming): Make getImage() call save against missing non-SVG version 47383/head
authorJoas Schilling <coding@schilljs.com>
Wed, 21 Aug 2024 08:30:25 +0000 (10:30 +0200)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Wed, 21 Aug 2024 10:03:02 +0000 (10:03 +0000)
Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/Repair/RepairLogoDimension.php

index 122da205986a0d76559ec0e9d933e51965f2e43f..854aeb3ab07562330afeb722a55ba2d34d57279b 100644 (file)
@@ -9,6 +9,8 @@ declare(strict_types=1);
 namespace OC\Repair;
 
 use OCA\Theming\ImageManager;
+use OCP\Files\NotFoundException;
+use OCP\Files\NotPermittedException;
 use OCP\IConfig;
 use OCP\Migration\IOutput;
 use OCP\Migration\IRepairStep;
@@ -44,9 +46,18 @@ class RepairLogoDimension implements IRepairStep {
                        return;
                }
 
-               $simpleFile = $imageManager->getImage('logo', false);
-
-               $image = @imagecreatefromstring($simpleFile->getContent());
+               try {
+                       try {
+                               $simpleFile = $imageManager->getImage('logo', false);
+                               $image = @imagecreatefromstring($simpleFile->getContent());
+                       } catch (NotFoundException|NotPermittedException) {
+                               $simpleFile = $imageManager->getImage('logo');
+                               $image = false;
+                       }
+               } catch (NotFoundException|NotPermittedException) {
+                       $output->info('Theming is not used to provide a logo');
+                       return;
+               }
 
                $dimensions = '';
                if ($image !== false) {