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 13:59:08 +0200
commitdd68f678b20d7a0a286f112dc3bb22f87b8cbb46 (patch)
treec44695f97553e22e2cb238e58d2b5e7c204bb0d2
parente82ab7816fcbf5c2451e1ec016cf18a332c38934 (diff)
downloadnextcloud-server-dd68f678b20d7a0a286f112dc3bb22f87b8cbb46.tar.gz
nextcloud-server-dd68f678b20d7a0a286f112dc3bb22f87b8cbb46.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 faab6e74eb0..b6e571b134e 100644
--- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
@@ -495,6 +495,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);
}