diff options
author | Robin Appelman <robin@icewind.nl> | 2024-09-18 13:54:21 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2024-09-19 17:44:53 +0200 |
commit | 79e7c48144752898170ed65894c60687b448d547 (patch) | |
tree | ba514e9edba6d0f91ebe252bd1abdf4f517b98a1 | |
parent | 6c9bef6857e4e8b9caabd05d2b24fb05e4c53a47 (diff) | |
download | nextcloud-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.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 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); } |