Skip to content

Commit

Permalink
Merge pull request #47384 from nextcloud/backport/47380/stable29
Browse files Browse the repository at this point in the history
[stable29] fix(theming): Make getImage() call save against missing non-SVG version
  • Loading branch information
nickvergessen authored Aug 21, 2024
2 parents 4606fb2 + ef75627 commit 132137d
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 132137d

Please sign in to comment.