aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-09-18 13:54:21 +0200
committerRobin Appelman <robin@icewind.nl>2024-09-18 14:11:27 +0200
commit3c0c81bb94456479b36e968eb77fe3e23ce2dcc1 (patch)
treeeb1349738b00dda9acb9be05dbfef28c546e1f87 /lib
parent74adaebf965239ebeac947428c6d3fcf9fb50953 (diff)
downloadnextcloud-server-3c0c81bb94456479b36e968eb77fe3e23ce2dcc1.tar.gz
nextcloud-server-3c0c81bb94456479b36e968eb77fe3e23ce2dcc1.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')
-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 631ebf5bc81..60affa4b89e 100644
--- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
@@ -492,6 +492,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);
}