Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 10, 2025

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
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.

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

2 participants