diff --git a/apps/dashboard/lib/Service/BackgroundService.php b/apps/dashboard/lib/Service/BackgroundService.php index f9bd987bdcac2..0619fd8d30428 100644 --- a/apps/dashboard/lib/Service/BackgroundService.php +++ b/apps/dashboard/lib/Service/BackgroundService.php @@ -149,6 +149,10 @@ public function setFileBackground($path): void { $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')); }