Skip to content

Commit

Permalink
fix(dav): use quota of destination in s3 chunk upload
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
max-nextcloud authored and backportbot-nextcloud[bot] committed Aug 2, 2023
1 parent e33ac4e commit 4f2a538
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/dav/lib/Upload/ChunkingV2Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
}
Expand Down

0 comments on commit 4f2a538

Please sign in to comment.