fix: ensure parent folder exists when writing a file to object storage

Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/48213/head
Robin Appelman 2024-09-18 13:54:21 +07:00 committed by Louis
parent f1df40f718
commit 6421581c00
1 changed files with 4 additions and 0 deletions

@ -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);
}