diff options
author | Joas Schilling <coding@schilljs.com> | 2024-08-21 10:30:25 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2024-08-21 10:30:25 +0200 |
commit | dbbe2bbcb7cc03420e90b93c357a9c560c4b367c (patch) | |
tree | 844f968e2b70fbb43696216358eadf0de6a763f1 | |
parent | cf56874cb1cb6150eadaf673474785e6b86937f7 (diff) | |
download | nextcloud-server-dbbe2bbcb7cc03420e90b93c357a9c560c4b367c.tar.gz nextcloud-server-dbbe2bbcb7cc03420e90b93c357a9c560c4b367c.zip |
fix(theming): Make getImage() call save against missing non-SVG version
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | lib/private/Repair/RepairLogoDimension.php | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/private/Repair/RepairLogoDimension.php b/lib/private/Repair/RepairLogoDimension.php index 122da205986..854aeb3ab07 100644 --- a/lib/private/Repair/RepairLogoDimension.php +++ b/lib/private/Repair/RepairLogoDimension.php @@ -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) { |