Skip to content

fix(provisioning_api): only count user files in quota usage - #65993

Open
MarioPym wants to merge 1 commit into
nextcloud:masterfrom
MarioPym:fix/provisioning-quota-used-object-store
Open

MarioPym wants to merge 1 commit into
nextcloud:masterfrom
MarioPym:fix/provisioning-quota-used-object-store

Conversation

@MarioPym

Copy link
Copy Markdown

Summary

Since #49476, AUserDataOCSController::fillStorageInfo() reads the used space from the home storage root (''). On local storage, this works because HomeCache overrides the root size with the size of files/. However, HomeObjectStoreStorage does not use HomeCache, meaning that when S3 is used as primary storage, the root size improperly includes files_trashbin, files_versions, and uploads.

Consequently, GET /ocs/v2.php/cloud/users/<uid> reports inflated quota usage (sometimes resulting in negative free space), whereas quota enforcement (Quota wrapper, root => 'files') correctly counts only files/. This causes mobile clients to incorrectly display accounts as full.

This PR changes the controller to read the cache entry of the user folder (files) directly. For local home storage, the resulting value remains identical.

Note: DAV quota-used-bytes (via OC_Helper::getStorageInfo()) shares this issue on object stores because it also queries the cache for ''. Making HomeObjectStoreStorage utilize HomeCache like Home would resolve both issues. I have kept this PR scoped strictly to the provisioning API, but I am happy to open a separate PR for the storage layer if that is the preferred direction.

How to test

  1. Use S3 as primary object storage, create a user with a 10 MB quota.
  2. Upload a 3 MB file twice (one version), upload and delete a 2 MB file (trash bin), and leave a 2 MB chunked upload unfinished.
  3. GET /ocs/v2.php/cloud/users/<uid>:
    • Before: used 10485924, free -164, relative 100
    • After: used 3145892, free 7339868, relative 30

Checklist

AI (if applicable)

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

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Mario Alfonso Pym Mejía <pymm@hitss.com>
@MarioPym
MarioPym requested a review from a team as a code owner October 28, 2026 23:00
@MarioPym
MarioPym requested review from Altahrim, provokateurin, salmart-dev and sorbaugh and removed request for a team October 28, 2026 23:00

This branch has not been deployed

No deployments
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.

1 participant