Skip to content

feat(e2ee): support copying and moving encrypted files and folders - #18057

Open
xO-ox-ai wants to merge 5 commits into
nextcloud:masterfrom
xO-ox-ai:feat/e2ee-copy-move
Open

xO-ox-ai wants to merge 5 commits into
nextcloud:masterfrom
xO-ox-ai:feat/e2ee-copy-move

Conversation

@xO-ox-ai

@xO-ox-ai xO-ox-ai commented Nov 16, 2026 •

Copy link
Copy Markdown

The Android client currently does not support copying or moving encrypted files and folders into either ordinary or encrypted folders. This adds those operations while reusing the existing folder creation and upload code.

When the destination has a different encryption state, show a confirmation before transferring. Ordinary items entering an encrypted folder are encrypted. Encrypted files entering an ordinary folder are decrypted. For encrypted folders entering an ordinary folder, offer the choice to keep the folders encrypted or decrypt their contents.

Use decrypted names for destination names and ciphertext paths for server requests. A move deletes the source only after the complete copy succeeds, with an ETag condition to preserve a source changed during transfer. Unsynced local edits and conflicts also preserve the source. Temporary transfer uploads do not update nonexistent upload queue entries.

Validation

The contributor tested the operations on an Android phone against a live Nextcloud instance and supplied the client logs. The logs confirm these file operations:

Operation Source Destination Observed result
Move Encrypted Ordinary Download 200, upload 201, encrypted source deletion 204, source metadata update and unlock
Move Ordinary Encrypted Download 200, upload 201, destination metadata update and unlock, source DELETE after upload
Move Encrypted Encrypted Download 200, upload 201, destination unlock, source deletion 204 and source metadata update/unlock
Copy Encrypted Encrypted Download 200, upload 201, destination metadata update/unlock, no source DELETE
Copy Encrypted Ordinary Download 200, upload 201, no source DELETE
Copy Ordinary Encrypted Download 200, upload 201, destination metadata update/unlock, no source DELETE

An overwrite attempt returned INVALID_OVERWRITE before any file upload or deletion. The logs also exposed attempts to update upload ID -1; this PR fixes that and includes regression tests. Personal logs and file names are not attached.

  • 34 focused unit tests pass, including recursive folders, keeping folder encryption, distinct display/storage names, authenticated decryption, partial-copy failures, conditional source deletion, metadata failures, and transient upload bookkeeping.
  • The separate personal integration build passes 240 related tests, Kotlin formatting, Detekt, Lint, and QA release assembly. Two existing tests that assume Unix filesystem paths are excluded on Windows.
  • The standalone feature branch also builds; its full Lint/Detekt results retain existing upstream findings in unrelated files. SpotBugs was run directly because the Gradle launcher exceeds the Windows command-line limit; no missing classes or analysis errors, with existing findings in untouched methods.
  • The live log evidence above concerns files. Recursive folder handling and the keep-encryption choice are covered by automated tests; they are not independently confirmed by these log entries.

Checklist

  • Tests are included.
  • Backport requests are not needed.
  • Milestone is set.
  • PR title describes the user-visible change.

AI assistance

This contribution was developed and tested with assistance from Codex (GPT-6). The problem statement and requested behavior above are translated from the contributor's own messages; the contributor performed the phone tests and authorized publication and the additional test details derived from the exported logs.

xO-ox-ai and others added 5 commits November 16, 2026 18:30
Enable encrypted file and folder transfers with confirmation when crossing encryption states. Reuse folder creation and upload operations, preserve display names, and delete move sources only after a complete copy with a matching source version.

Assisted-by: Codex:GPT-6
Signed-off-by: Li Wei <caeser222000@sohu.com>
Only persist upload results and encryption lock tokens when the reused upload operation has a stored upload ID. Copy and move transfers execute synchronously without a queue entry.

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

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