Merge pull request #32793 from nextcloud/backport/32675/stable22

[stable22] Validate custom dashboard background image
This commit is contained in:
blizzz 2022-07-06 13:33:35 +02:00 committed by GitHub
commit 4a7775f78b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -149,6 +149,10 @@ class BackgroundService {
$userFolder = $this->rootFolder->getUserFolder($this->userId);
/** @var File $file */
$file = $userFolder->get($path);
$image = new \OCP\Image();
if ($image->loadFromFileHandle($file->fopen('r')) === false) {
throw new InvalidArgumentException('Invalid image file');
}
$this->getAppDataFolder()->newFile('background.jpg', $file->fopen('r'));
}