aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-09-18 13:54:21 +0200
committerRobin Appelman <robin@icewind.nl>2024-09-19 17:44:53 +0200
commit79e7c48144752898170ed65894c60687b448d547 (patch)
treeba514e9edba6d0f91ebe252bd1abdf4f517b98a1
parent6c9bef6857e4e8b9caabd05d2b24fb05e4c53a47 (diff)
downloadnextcloud-server-79e7c48144752898170ed65894c60687b448d547.tar.gz
nextcloud-server-79e7c48144752898170ed65894c60687b448d547.zip
fix: ensure parent folder exists when writing a file to object storage
Signed-off-by: Robin Appelman <robin@icewind.nl>
-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 63fb0d92bb0..423255e2c9a 100644
--- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
@@ -518,6 +518,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);
}