mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Validate custom dashboard background image
Signed-off-by: Christopher Ng <chrng8@gmail.com>
This commit is contained in:
parent
254cb7ad0c
commit
59ca7931e1
1 changed files with 4 additions and 0 deletions
|
|
@ -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'));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue