Skip to content

fix(quota): protect local files from deletion when quota blocked upload.#10001

Draft
camilasan wants to merge 2 commits intomasterfrom
bugfix/quota-deletion
Draft

fix(quota): protect local files from deletion when quota blocked upload.#10001
camilasan wants to merge 2 commits intomasterfrom
bugfix/quota-deletion

Conversation

@camilasan
Copy link
Copy Markdown
Member

@camilasan camilasan commented May 7, 2026

Resolves

When files fail to upload due to a storage quota error, they never reach the server and have no sync record. If the user then moves the affected folder from the web interface, the sync client sees the folder as deleted and removes the local copies - permanently losing data that was never backed up.

A second, quieter variant of the same problem exists when the server's PROPFIND response already reports zero available space: those files are rejected during discovery before any upload is attempted, so they also end up with no protective record and are equally at risk.

Fix: Before deleting a local file inside a remotely-deleted folder, the client now checks the error blacklist for an InsufficientRemoteStorage entry. If one is found, the file is kept locally and surfaced as an error instead of being silently removed. The parent folder is preserved too, so the file stays reachable until the user resolves the quota situation.

_httpErrorCode is set to 507 on both the protected item and on files rejected by the discovery phase quota check. This ensures blacklistUpdate writes - and keeps renewing - the InsufficientRemoteStorage entry, so protection holds across multiple sync cycles even after the initial backoff period expires.

Files that were previously synced successfully are unaffected.

TODO

  • manually test it

Checklist

AI (if applicable)

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

@camilasan camilasan added this to the 33.0.5 milestone May 7, 2026
@camilasan camilasan added the bug label May 7, 2026
@camilasan camilasan force-pushed the bugfix/quota-deletion branch from 1508fc1 to 6a96d3a Compare May 7, 2026 20:44
@camilasan camilasan changed the title fix: fix(quota): protect local files from deletion when quota blocked upload. May 7, 2026
camilasan added 2 commits May 7, 2026 23:45
If a file failed to upload because the server quota was exceeded (HTTP
507), it was never actually stored on the server — but the sync client
could still delete the local copy when the remote parent folder was
later moved or deleted via the web interface.

- checkNewDeleteConflict() now checks the error blacklist before issuing
a local REMOVE. If the file carries an InsufficientRemoteStorage entry,
it is kept locally and reported as a soft error instead.
- The same _httpErrorCode = 507 is now also set in the discovery-phase
quota check.

Files that were previously synced are unaffected.

Signed-off-by: Camila Ayres <hello@camilasan.com>
…letion.

Two cases:
- quota blocked file survives when its remote parent folder is deleted;
  already synced siblings are still removed.
- regression: a plain new file with no quota error in a server deleted
  folder continues to be deleted as before.

Signed-off-by: Camila Ayres <hello@camilasan.com>
@camilasan camilasan force-pushed the bugfix/quota-deletion branch from 6a96d3a to cb01eb1 Compare May 7, 2026 21:49
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Artifact containing the AppImage: nextcloud-appimage-pr-10001.zip

Digest: sha256:51a366aec6b506bdc48f8b2c97856b4d02056da407acbd2cf472547d9ccd3e61

To test this change/fix you can download the above artifact file, unzip it, and run it.

Please make sure to quit your existing Nextcloud app and backup your data.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 7, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
E Maintainability Rating on New Code (required ≥ A)
56 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@camilasan
Copy link
Copy Markdown
Member Author

/backport to stable-33.0

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant