Skip to content

resolve #61488#61594

Open
0x7d8 wants to merge 2 commits into
nextcloud:masterfrom
0x7d8:patch-1
Open

resolve #61488#61594
0x7d8 wants to merge 2 commits into
nextcloud:masterfrom
0x7d8:patch-1

Conversation

@0x7d8

@0x7d8 0x7d8 commented Jun 25, 2026

Copy link
Copy Markdown

Summary

On primary object storage (S3 and other object stores) with a finite per-user
quota, chunked uploads fail with HTTP 413 EntityTooLarge / "Insufficient
space" regardless of how much quota is actually free. A ~250 MB upload was
rejected with ~8.4 GiB of free quota; reducing the chunk size had no effect,
and setting the quota to Unlimited worked around it.

Root cause is in OC\Files\Storage\Wrapper\Quota::writeStream(). Chunk parts
are written to the quota-exempt uploads/ path, for which free_space()
returns the wrapped storage's value. Object stores return
FileInfo::SPACE_UNLIMITED (-3) there, so the if ($size < $free) check
evaluates $size < -3, which is always false, and the method throws
NotEnoughSpaceException.

writeStream() was the only write method missing the $free < 0 short-circuit
that file_put_contents(), copy(), copyFromStorage(), and
moveFromStorage() already use, and that QuotaPlugin::checkQuota() applies at
the DAV layer. The fix adds that guard. On local storage the bug does not
trigger because free_space() returns a real positive value for the uploads
path.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: Robert Jansen <me@rjns.dev>
@0x7d8 0x7d8 requested a review from a team as a code owner June 25, 2026 14:07
@0x7d8 0x7d8 requested review from ArtificialOwl, icewind1991, leftybournes and salmart-dev and removed request for a team June 25, 2026 14:07
Signed-off-by: Robert Jansen <me@rjns.dev>
@0x7d8

0x7d8 commented Jun 25, 2026

Copy link
Copy Markdown
Author

@provokateurin

@0x7d8

0x7d8 commented Jun 25, 2026

Copy link
Copy Markdown
Author

I assume backport would apply to this, for what versions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Chunked upload to object-store (S3) primary fails with 413 "Insufficient space" for any user with a finite quota, regardless of free space

1 participant