Skip to content

feat: implement server-requested file re-upload via request-upload property - #9219

Draft
kesselb with Copilot wants to merge 4 commits into
masterfrom
copilot/add-file-reupload-feature
Draft

feat: implement server-requested file re-upload via request-upload property#9219
kesselb with Copilot wants to merge 4 commits into
masterfrom
copilot/add-file-reupload-feature

Conversation

Copilot AI commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

Description

Implements support for the http://nextcloud.org/ns:request-upload WebDAV property, allowing the server to trigger client-side file re-uploads without local changes.

Changes

Core Implementation:

  • Added requestUpload field to RemoteInfo struct
  • Extended PROPFIND queries to fetch request-upload property
  • Implemented property parsing in LsColJob::propertyMapToRemoteInfo()
  • Added discovery logic to trigger uploads when property is set:
    • Checks for local file existence (including VFS placeholders)
    • Sets _instruction = CSYNC_INSTRUCTION_SYNC and _direction = SyncFileItem::Up
    • Ignores directories and virtual files without local data
    • Handles both database-known files and new remote entries

Example flow:

// Server sets property in PROPFIND response:
<nc:request-upload>1</nc:request-upload>

// Client discovers during sync:
if (serverEntry.requestUpload && !serverEntry.isDirectory && localEntry.isValid()) {
    item->_instruction = CSYNC_INSTRUCTION_SYNC;
    item->_direction = SyncFileItem::Up;
}

Testing:

  • Unit tests for regular files, directories, and VFS scenarios

Use Cases

Server-initiated re-uploads for data recovery, storage migration, checksum validation, or compliance requirements.

Original prompt

This section details on the original issue you should resolve

<issue_title>Make the desktop client reupload a given file when requested by the remote</issue_title>
<issue_description>

Feature request

  1. The nextcloud server might provide a dav property {http://nextcloud.org/ns}request-upload. That property might exists, or not. We need to request it during the propfind request for the sync. Either's either 0 or 1.

  2. If request-upload is one, the client should check if we have a local copy of the file (either classic mode or vfs) and if so, we should upload that copy. It should use exactly the same logic as when the watcher detects a change for a file the file system. Alternative idea: If, for whatever reason, it's to complicate/impossible to queue an upload during the discover phase, we could also consider to just modify the mtime of the local file and let the watcher take over.
    </issue_description>

Comments on the Issue (you are @copilot in this section)


馃挰 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits December 10, 2025 10:38
- Add requestUpload field to RemoteInfo struct
- Request request-upload property in PROPFIND queries
- Parse request-upload property and store in RemoteInfo
- Handle request-upload in discovery for both existing and new files
- When request-upload is set, trigger upload if local copy exists

Co-authored-by: kesselb <3902676+kesselb@users.noreply.github.com>
- Test basic request-upload functionality with regular files
- Test that request-upload is ignored for directories
- Test request-upload behavior with virtual files

Co-authored-by: kesselb <3902676+kesselb@users.noreply.github.com>
Co-authored-by: kesselb <3902676+kesselb@users.noreply.github.com>
Copilot AI changed the title [WIP] Add functionality to reupload files upon remote request feat: implement server-requested file re-upload via request-upload property Dec 10, 2025
Copilot AI requested a review from kesselb December 10, 2025 10:43
@mgallien mgallien added this to the 33.0.0 milestone Jan 21, 2026
@mgallien mgallien self-assigned this Jan 21, 2026
@Rello Rello modified the milestones: 33.0.0, 33.0.1 Mar 4, 2026
@nilsding nilsding modified the milestones: 33.0.1, 33.0.2, 33.0.3 Mar 30, 2026
@mgallien mgallien modified the milestones: 33.0.3, 34.0.0 Apr 23, 2026
@camilasan

Copy link
Copy Markdown
Member

I pinged @Rello in chat, we should move forward with this PR.

@Rello Rello moved this to 馃搫 To do in 馃捇 Desktop Clients team May 12, 2026
@Rello Rello modified the milestones: 34.0.0, 35.0.0 Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 馃搫 To do

Development

Successfully merging this pull request may close these issues.

Make the desktop client reupload a given file when requested by the remote

6 participants