Repository navigation
Conversation
Keep ordinary file locks tied to their file ID across upload completion. Rediscover encrypted uploads after the unlock commits staged replacements. Decode recovered folder tokens before sending them, retain recovery records on unsuccessful unlocks, and wait for recovery before starting discovery. Terminate failed or cancelled recovery without consuming late replies. Assisted-by: Codex:GPT-6 Signed-off-by: Li Wei <caeser222000@sohu.com>
Signed-off-by: Li Wei <caeser222000@sohu.com> Assisted-by: Codex:GPT-6
Keep this change compatible with the current upstream dependencies and updates. Signed-off-by: Li Wei <caeser222000@sohu.com> Assisted-by: Codex:GPT-6
|
This combined PR is superseded by two independently tested changes.
The separate branches each pass their own Qt 6 regression suite. |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Summary
A replacement at the same path can receive a new file ID while retaining the previous file's cached ordinary lock. Upload completion now checks file identity as well as ETag before copying lock state, and clears the old identity's lock fields. Successful encrypted upload commits also schedule remote discovery to retrieve the final server state after unlock.
Abandoned E2EE folder locks have a separate recovery problem: the asymmetric decryption helper returns Base64 text, and unsuccessful unlock replies currently discard the saved token. Decode recovered tokens, retain them until unlock and local deletion succeed, and finish recovery before starting discovery. Failed recovery terminates the current sync round with a delayed follow-up; cancellation disconnects late replies. Re-locking proceeds only after successful recovery.
No server API or cryptographic storage format changes. HTTP 403/404 remain errors and preserve recovery credentials; this does not force-unlock folders.
Validation
Using the project's official
continuous-integration-client-qt6:client-sid-6.10.2-4image, Qt 6.10.2, Clang 21.1.8, Debug and-Werror:nextcloudand both new test targets.E2eeLockRecoveryTestandUploadLockStateTestpassed: 60 and 17 QtTest results, including initialization/cleanup.LockFileTest,UploadResetTest,AsyncOpTest,SyncFileItemTest,SyncEngineTest, andChunkingNgTestall passed.The automated tests above use fake server replies and temporary databases.
Additional Windows and live-server validation (2026-11-13)
A Windows QA build based on v35.0.3 with this patch was tested against Nextcloud Server 35.0.2.2, end_to_end_encryption 2.6.0, and files_lock 35.0.1. The existing account, credentials, encryption settings, cache, and sync journal were retained during replacement of the installed client.
The existing client's incident logs showed a file ID change after an encrypted upload while the old ordinary lock state remained cached. A later file PUT failed with HTTP 412 and a DAV
Ifprecondition error. The subsequent E2EE rollback request returned 403, the local recovery record was discarded, and further attempts to lock the folder returned 423. The server still held the folder lock created by that failed transaction, with different committed and intermediate metadata. The original PUT's fullIfheader was not captured, so the precise ordinary-token mismatch remains an inference from the logs and code.Because the old client had already discarded its recovery record, upgrading alone could not restore that record. After backing up the affected server directory and transaction metadata, an administrator read the existing server lock token, encrypted it with the account's existing public certificate, and restored the corresponding encrypted recovery record to the stopped client's journal. This was a one-time manual repair to prepare the abandoned transaction for the client's normal recovery path; it is not a new automatic token-retrieval capability. No server lock row was directly deleted, and no mnemonic or private key was required.
On resuming sync, the patched client:
abort=true(HTTP 200).The local document's hash remained identical to its pre-recovery backup. A journal snapshot after recovery passed SQLite
quick_check, contained no pending E2EE recovery records, and showed the target file as unlocked.The native Windows build used MSVC 14.44.35207, Windows SDK 10.0.26100.0, Qt 6.11.2, and OpenSSL 3.6.5. The client, command-line client, and both Windows VFS plugins built successfully. All eight test targets listed above passed;
E2eeLockRecoveryTestandUploadLockStateTestalso passed using the installed client's existing runtime libraries.Scope of these results: the Windows QA build included a local, uncommitted
OWNCLOUDSYNC_EXPORTdeclaration forPollJob, required to link the new polling regression test on Windows. Its build snapshot also honored the disabled shell-integration build option and generated the required icon-index configuration; the installed Explorer extensions were retained. These results therefore describe that QA build, not an unmodified native build of the current PR head. No additional commits have been pushed.Repeated WPS saves in an encrypted folder (2026-11-13)
Using the same installed Windows QA build and live server described above, a
test.docxdocument was created in the affected encrypted folder and repeatedly edited and saved in WPS. Client logs from 19:23 through 23:09 (UTC+8) recorded six uploads: the initial empty-file creation and five content updates. All six file PUTs returned HTTP 201, all six E2EE commit/unlock requests returned HTTP 200, and every upload completed withSyncFileItem::Success. The content updates finished at 19:24:16, 19:24:30, 19:26:17, 19:32:32, and 23:05:33.The logs demonstrate the common workflow covered by the ordinary-lock fix: opening an encrypted Office document creates an ordinary server file lock, and saving a replacement at the same path changes its server file ID. The initial file was locked successfully at 19:23:59. On the first content upload, its ID changed from 45030 to 45041; the client immediately recorded the new ID with the old identity's cached lock fields cleared. Later saves received IDs 45047, 45053, 45059, and 45065 and uploaded successfully. Subsequent remote discovery matched the final file ID, ETag, and encrypted-content checksum to the sync journal and required no further file transfer.
There were no HTTP 412/403/423 failures,
abort=truerequests, or abandoned-lock recovery jobs during these document tests. This validates normal repeated-save processing and invalidation of stale lock state; the successful uploads were not failed E2EE transactions being hidden by rollback/retry recovery. WPS temporary lock files were ignored by the normal exclusion rules. Save operations can be coalesced by sync, so the upload count is not a count of individual Save actions.AI assistance
Code, tests, analysis, and this description were assisted by Codex (GPT-6), under the contributor's direction. The commit includes an Assisted-by trailer.