diff options
author | Robin Appelman <robin@icewind.nl> | 2024-09-18 13:54:21 +0200 |
---|---|---|
committer | Louis <louis@chmn.me> | 2024-10-08 18:14:26 +0200 |
commit | 6421581c0084a5a093cfd91f9c93b8d46112746a (patch) | |
tree | 0fe60ddee3eb6073758e5d223eda48cfdef26f70 /lib/private | |
parent | f1df40f718e1f02256008e4998eec0b9ce54bb69 (diff) | |
download | nextcloud-server-6421581c0084a5a093cfd91f9c93b8d46112746a.tar.gz nextcloud-server-6421581c0084a5a093cfd91f9c93b8d46112746a.zip |
fix: ensure parent folder exists when writing a file to object storage
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Files/ObjectStore/ObjectStoreStorage.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index 05677632607..c9fbe11bbfa 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -514,6 +514,10 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil if ($exists) { $fileId = $stat['fileid']; } else { + $parent = $this->normalizePath(dirname($path)); + if (!$this->is_dir($parent)) { + throw new \InvalidArgumentException("trying to upload a file ($path) inside a non-directory ($parent)"); + } $fileId = $this->getCache()->put($uploadPath, $stat); } |