From 4f2a538b7ad04bc96893d4ff5be25d2308916fd0 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 2 Aug 2023 10:09:13 +0200 Subject: [PATCH] fix(dav): use quota of destination in s3 chunk upload Resolves: #39228. Check the free space on the destination. Before it was checking the free space on `$storage` which is the upload storage of the user who triggered the upload. This led to user quota being applied even when uploading to a share with unlimited space. Signed-off-by: Max --- apps/dav/lib/Upload/ChunkingV2Plugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/dav/lib/Upload/ChunkingV2Plugin.php b/apps/dav/lib/Upload/ChunkingV2Plugin.php index d3673c6bde776..97ae51fbe380b 100644 --- a/apps/dav/lib/Upload/ChunkingV2Plugin.php +++ b/apps/dav/lib/Upload/ChunkingV2Plugin.php @@ -168,7 +168,7 @@ public function beforePut(RequestInterface $request, ResponseInterface $response [$destinationDir, $destinationName] = Uri\split($this->uploadPath); /** @var Directory $destinationParent */ $destinationParent = $this->server->tree->getNodeForPath($destinationDir); - $free = $storage->free_space($destinationParent->getInternalPath()); + $free = $destinationParent->getNode()->getFreeSpace(); $newSize = $tempTargetFile->getSize() + $additionalSize; if ($free >= 0 && ($tempTargetFile->getSize() > $free || $newSize > $free)) { throw new InsufficientStorage("Insufficient space in $this->uploadPath"); @@ -225,7 +225,7 @@ public function beforeMove($sourcePath, $destination): bool { foreach ($parts as $part) { $size += $part['Size']; } - $free = $storage->free_space($destinationParent->getInternalPath()); + $free = $destinationParent->getNode()->getFreeSpace(); if ($free >= 0 && ($size > $free)) { throw new InsufficientStorage("Insufficient space in $this->uploadPath"); }