Merge pull request #47380 from nextcloud/bugfix/noid/make-logo-dimension-more-save

fix(theming): Make getImage() call save against missing non-SVG version
pull/47370/head
Joas Schilling 2024-08-21 12:01:44 +07:00 committed by GitHub
commit c07cf51beb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 3 deletions

@ -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) {