diff options
author | Joas Schilling <coding@schilljs.com> | 2024-08-21 10:30:25 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2024-08-21 10:04:54 +0000 |
commit | ef756278ae6953694bd237f9b4968650407b6659 (patch) | |
tree | e0a78db85f112cb126179a62d0dc3885953f7e2b /lib | |
parent | e559a81305bb760c1f7361ab28a8a26af6355c00 (diff) | |
download | nextcloud-server-ef756278ae6953694bd237f9b4968650407b6659.tar.gz nextcloud-server-ef756278ae6953694bd237f9b4968650407b6659.zip |
fix(theming): Make getImage() call save against missing non-SVG version
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-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) { |