aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-09-18 13:54:21 +0200
committerLouis <louis@chmn.me>2024-10-08 18:14:26 +0200
commit6421581c0084a5a093cfd91f9c93b8d46112746a (patch)
tree0fe60ddee3eb6073758e5d223eda48cfdef26f70 /lib/private
parentf1df40f718e1f02256008e4998eec0b9ce54bb69 (diff)
downloadnextcloud-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.php4
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);
}