Skip to content

Commit

Permalink
fix(theming): Make getImage() call save against missing non-SVG version
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen authored and backportbot[bot] committed Aug 21, 2024
1 parent 8c03d84 commit 192fe5d
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lib/private/Repair/RepairLogoDimension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
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;
Expand Down Expand Up @@ -44,9 +46,18 @@ public function run(IOutput $output): void {
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) {
Expand Down

0 comments on commit 192fe5d

Please sign in to comment.