Skip to content

Commit

Permalink
Merge pull request #32792 from nextcloud/backport/32675/stable23
Browse files Browse the repository at this point in the history
[stable23] Validate custom dashboard background image
  • Loading branch information
blizzz authored Jul 5, 2022
2 parents 0882642 + bb7b115 commit 9d91248
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/dashboard/lib/Service/BackgroundService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}

Expand Down

0 comments on commit 9d91248

Please sign in to comment.