summaryrefslogtreecommitdiffstats
path: root/apps/dashboard/lib
diff options
context:
space:
mode:
authorChristopher Ng <chrng8@gmail.com>2022-05-31 19:31:52 +0000
committerChristopher Ng <chrng8@gmail.com>2022-06-02 00:24:35 +0000
commit00135986ab79e7fb15dc642b5308e62608d0ea59 (patch)
treec8bee41cf834e249aba63de7df1d9531a33071cd /apps/dashboard/lib
parent581bb62d9cdd954c75babc20b27cc111df99f026 (diff)
downloadnextcloud-server-00135986ab79e7fb15dc642b5308e62608d0ea59.tar.gz
nextcloud-server-00135986ab79e7fb15dc642b5308e62608d0ea59.zip
Validate custom dashboard background image
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'apps/dashboard/lib')
-rw-r--r--apps/dashboard/lib/Service/BackgroundService.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/apps/dashboard/lib/Service/BackgroundService.php b/apps/dashboard/lib/Service/BackgroundService.php
index 13ad03cf860..c98b92412cb 100644
--- a/apps/dashboard/lib/Service/BackgroundService.php
+++ b/apps/dashboard/lib/Service/BackgroundService.php
@@ -150,6 +150,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'));
}