Skip to content

fix(file-provider): invalidate lock tokens when file paths change. #10135

Draft
camilasan wants to merge 2 commits into
masterfrom
bugfix/fpext-invalidate-lock-tokens
Draft

fix(file-provider): invalidate lock tokens when file paths change. #10135
camilasan wants to merge 2 commits into
masterfrom
bugfix/fpext-invalidate-lock-tokens

Conversation

@camilasan

@camilasan camilasan commented Jun 9, 2026

Copy link
Copy Markdown
Member

Resolves

This PR is related to #10134, better to merge it afterwards.

Stale WebDAV lock token cleared on path change — when an editor locks a file the server issues a token bound to that file's path. If the parent folder is renamed the token becomes invalid.

The next save attempt sends a stale If: header. The server rejects it with 412/423, and the user cannot save — they must manually copy the file elsewhere.

Summary

The code now clears it whenever a rename is detected: during sync, in the DB rename functions, and on upload errors 412 and 423.

Steps to test it

  1. Open Spreadsheet.xlsx from a group folder via Finder (server issues a WebDAV lock).
  2. While the file is open, rename its parent folder from another client or the web UI.
  3. Edit the file content.
  4. Save.
    ✅ Save must succeed — no error dialog.
    ✅ The updated file must appear in the web UI with the new content.
  5. Edit and save a second time.
    ✅ The second save must also succeed (confirms the token stays clear).
    Enable verbose logging to confirm the log shows "Clearing stale lock token" followed by a successful upload.

Checklist

AI (if applicable)

camilasan added 2 commits June 9, 2026 15:11
WebDAV lock tokens are bound to the path they were issued for.
When a parent folder moves, child lock tokens become stale and
cause 412/423 upload failures. Clear tokens on rename propagation,
server metadata sync, and upload lock errors.

Assisted-by: Claude:claude-sonnet-4-5
Signed-off-by: Camila Ayres <hello@camilasan.com>
Assisted-by: Claude:claude-sonnet-4-5
Signed-off-by: Camila Ayres <hello@camilasan.com>
@camilasan

Copy link
Copy Markdown
Member Author

/backport to stable-33.0

@camilasan

Copy link
Copy Markdown
Member Author

/backport to stable-4.0

@sonarqubecloud

sonarqubecloud Bot commented Jun 9, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

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

Digest: sha256:df2b525c8ac559693c2e6edea15af74a0d4a3ec0474cbb840f405fbe7c8213e8

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.

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