]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(dav): use quota of destination in s3 chunk upload 39679/head
authorMax <max@nextcloud.com>
Wed, 2 Aug 2023 08:09:13 +0000 (10:09 +0200)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Wed, 2 Aug 2023 12:10:57 +0000 (12:10 +0000)
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 <max@nextcloud.com>
apps/dav/lib/Upload/ChunkingV2Plugin.php

index d3673c6bde77674d5f036d847ef6f99ead905650..97ae51fbe380b8013ed3eb3b3a13e1b676fed5f8 100644 (file)
@@ -168,7 +168,7 @@ class ChunkingV2Plugin extends ServerPlugin {
                        [$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 @@ class ChunkingV2Plugin extends ServerPlugin {
                        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");
                        }