Skip to content

fix(sync): clear stale lock state when an upload replaces a file - #11439

Open
xO-ox-ai wants to merge 2 commits into
nextcloud:masterfrom
xO-ox-ai:fix/upload-clear-replaced-file-lock-11437
Open

xO-ox-ai wants to merge 2 commits into
nextcloud:masterfrom
xO-ox-ai:fix/upload-clear-replaced-file-lock-11437

Conversation

@xO-ox-ai

Copy link
Copy Markdown

An upload can replace a file while keeping its path. Tie cached lock fields to the previous file ID and clear them when the upload response identifies a replacement. Use the existing journal lock refresh in direct, chunked, bulk and polled upload completion.

Fixes #11437. Split from #11313.

Validation: built and ran UploadLockStateTest against this standalone branch using the desktop Qt 6 CI image. The suite passed.

AI assistance: Codex (GPT-6) assisted with implementation, splitting, and validation.

Part of nextcloud#11313. Refs: nextcloud#11437.

Assisted-by: Codex:GPT-6
Signed-off-by: O.O <caeser222000@163.com>
@camilasan

camilasan commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

@xO-ox-ai e2ee is not my expertise, so you can judge if the points made make sense:

Must fix

  • bulkpropagatorjob.cpp:470: only assign _fileId from "fileid" when the value is non-empty. If the field is missing, _fileId becomes empty, the lock state is cleared and an empty file ID is written to the journal.
  • Please confirm that OC-FileID, the bulk "fileid" and the poll "fileId" all use the same format as the journal (padded ID plus instance ID). If any of them returns the bare numeric ID, the identity check fails and every upload drops a valid lock.

Optional

  • The identity check now happens both at the call sites and inside updateLockStateFromDbRecord(). One place is enough.
  • In the bulk path, the computeFileId() result is overwritten on the next line. Either remove the call or merge the "fileid" handling into it.
  • Add a bulk upload test. Bulk is the path with the riskiest change and it has no coverage.
  • The chunked test rewrites the If header into an ETag condition, so the token lock is never exercised there.
  • Fix the lock-owner serialization in FakePropfindReply instead of working around it with lockOwnerId = "2".

Assisted-by: Claude:claude-opus-5-5

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.

Upload replacement can retain the previous file’s lock in the local journal

2 participants