Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 10, 2026

Description

Pagination for WebDAV PROPFIND requests was disabled due to a server-side bug that caused incorrect results. This led to timeouts and memory exhaustion when enumerating folders with 1000+ files, as all items were fetched in a single request.

The server bug was fixed and backported to Nextcloud 31+. This change re-enables pagination with version gating to ensure compatibility.

Changes

Core Implementation (Enumerator.swift, 30 lines)

  • Check server capabilities to determine version (uses existing 30-min cache)
  • Enable pagination (pageSettings) only for serverVersion >= 31
  • Parse and forward pageIndex and pagination token from NSFileProviderPage
  • Remove unconditional nextPage = nil that disabled pagination
  • Older servers automatically fall back to non-paginated requests

Tests (EnumeratorTests.swift, 226 lines)

  • Verify pagination enabled for NC31+ servers
  • Verify graceful fallback for NC30 and older
  • Test multi-page enumeration with 50+ items

Technical Details

The implementation leverages existing pagination infrastructure:

  • EnumeratorPageResponse parses x-nc-paginate* headers from server
  • readServerUrl handles paginated requests when pageSettings != nil
  • Capabilities fetching is cached, no performance impact

Before:

let readResult = await Self.readServerUrl(
    serverUrl,
    pageSettings: nil,  // Always disabled
    // ...
)
// ...
nextPage = nil  // Force disable even if server provided next page

After:

let supportsPagination = (capabilities?.version.major ?? 0) >= 31
let pageSettings = supportsPagination ? (page: parsedPage, index: pageIndex, size: pageItemCount) : nil

let readResult = await Self.readServerUrl(
    serverUrl,
    pageSettings: pageSettings,  // Conditionally enabled
    // ...
)
// nextPage respects server response for NC31+

Scope

Changes are isolated to macOS File Provider (NextcloudFileProviderKit). Desktop sync client C++ code (LsColJob) does not currently support pagination and is out of scope.


Signed-off-by: GitHub Copilot noreply@github.com

Original prompt

This section details on the original issue you should resolve

<issue_title>Reenable Paginated WebDAV Requests</issue_title>
<issue_description>## Problem

When the desktop client requests the content listing of a directory with many items (like a few thousand or more), the request may fail both server or client side due to time outs or memory limits because the response always

Solution

Leverage paginated requests again. This was already implemented in the past but disabled to due to a regression in the server code.

Pitfalls

The server-side pagination was fixed but the fix is only available with Nextcloud 31 or newer. It must be assumed that older server releases do not support paginated responses. This must be taken into account in the implementation to gracefully still give clients connected to outdated server releases a chance.

History

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


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits February 10, 2026 14:36
Co-authored-by: i2h3 <142165879+i2h3@users.noreply.github.com>
Co-authored-by: i2h3 <142165879+i2h3@users.noreply.github.com>
Co-authored-by: i2h3 <142165879+i2h3@users.noreply.github.com>
Copilot AI changed the title [WIP] Reenable paginated WebDAV requests for large directories feat: re-enable WebDAV pagination for large folder enumeration on macOS Feb 10, 2026
Copilot AI requested a review from i2h3 February 10, 2026 14:44
@i2h3
Copy link
Collaborator

i2h3 commented Feb 10, 2026

This currently does not build yet and is blocked due to lack of server version exposure through NextcloudCapabilitiesKit which already is in the making:

nextcloud/NextcloudCapabilitiesKit#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.

Reenable Paginated WebDAV Requests

2 participants