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

@i2h3 i2h3 force-pushed the copilot/reenable-paginated-requests branch from 0d5eeba to d99b21b Compare February 11, 2026 12:56
@i2h3 i2h3 marked this pull request as ready for review February 11, 2026 12:56
Copilot AI review requested due to automatic review settings February 11, 2026 12:56
@i2h3
Copy link
Collaborator

i2h3 commented Feb 11, 2026

Enumerating a server (Nextcloud Docker container on localhost) directory with 10000 items takes more than 2 minutes in my case. The insertion of metadata into the client database could be accelerated significantly by using batch operations, it appears to be the current bottleneck. Any investment in the current database implementation is potentially a waste, though (see #9046). In general, this works fine.

@i2h3 i2h3 force-pushed the copilot/reenable-paginated-requests branch from d99b21b to 5262e89 Compare February 11, 2026 12:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR re-enables WebDAV pagination for large folder enumeration in the macOS File Provider extension. Pagination was previously disabled due to a server-side bug that has since been fixed and backported to Nextcloud 31+. The implementation adds version gating to conditionally enable pagination only for servers running Nextcloud 31 or newer, ensuring backward compatibility with older servers.

Changes:

  • Core implementation in Enumerator.swift adds server version detection and conditional pagination enablement
  • Comprehensive test suite with 226 lines of tests verifying pagination behavior for NC31+ and fallback for older servers
  • Dependency update to NextcloudCapabilitiesKit 2.4.6 (from 2.4.5)

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved Updates NextcloudCapabilitiesKit dependency from 2.4.5 to 2.4.6
shell_integration/MacOSX/NextcloudFileProviderKit/Tests/NextcloudFileProviderKitTests/EnumeratorTests.swift Adds three comprehensive tests for pagination: NC31+ enablement, NC30 fallback, and large folder handling with 50+ items
shell_integration/MacOSX/NextcloudFileProviderKit/Sources/NextcloudFileProviderKit/Enumeration/Enumerator.swift Implements server version detection, conditional pagination enablement, removes unconditional pagination disabling, and increases default page size from 100 to 1000
shell_integration/MacOSX/NextcloudFileProviderKit/Package.swift Bumps minimum macOS version from 11 to 12
AGENTS.md Adds clarification that iOS and Android platforms are irrelevant for this desktop client project

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI and others added 3 commits February 11, 2026 15:05
- Pagination was fixed for Nextcloud server 31 and newer.
- The client now dispatches paginated requests when connected to Nextcloud 31 or newer.
- Added tests.
- Updated to NextcloudCapabilitiesKit 2.4.6 which now exposes server version information which is required for the Nextcloud 31 and newer detection.
- Increased pagination size from 100 to 1000 because it barely makes a difference in memory usage on unlimited macOS.
Signed-off-by: Iva Horn <iva.horn@nextcloud.com>
…S to 12.

We do not support macOS before 12 anymore, anyway. This enables newer APIs.

Signed-off-by: Iva Horn <iva.horn@nextcloud.com>
@i2h3 i2h3 force-pushed the copilot/reenable-paginated-requests branch from 5262e89 to 1a17e11 Compare February 11, 2026 14:05
@github-actions
Copy link

Artifact containing the AppImage: nextcloud-appimage-pr-9442.zip

Digest: sha256:064813151c3bfaff79e2d158546ea92e311c696b8e48b3e90c996cdc40631024

To test this change/fix you can download the above artifact file, unzip it, and run it.

Please make sure to quit your existing Nextcloud app and backup your data.

@sonarqubecloud
Copy link

@i2h3 i2h3 merged commit 247e5cc into master Feb 11, 2026
21 of 22 checks passed
@i2h3 i2h3 deleted the copilot/reenable-paginated-requests branch February 11, 2026 14:55
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