Skip to content

Support legacy (Datasync/Zumo ≤ v6) clients that expect a relative nextLink #629

Open

Description

@asierpn

Describe the problem

TableController<TEntity>.QueryAsync builds PagedResult.NextLink as a query string only (for example $skip=50&$top=50). Datasync v6 clients (and earlier) resolve nextLink against the host root, not against the table URL. They also send the X-ZUMO-OPTIONS: nextLink=path header to indicate this. A query-only nextLink makes those clients request the wrong URL, so paging fails once a result set exceeds PageSize.

To Reproduce

  1. Host a table controller using CommunityToolkit.Datasync.Server with more rows than Options.PageSize.
  2. Query it from a v6 client, which sends the header X-ZUMO-OPTIONS: nextLink=path.
  3. Inspect nextLink in the response and let the client follow it.
  4. The client doesn't request tables/<table>?$skip=..., so paging fails.

Expected behavior

When the request carries X-ZUMO-OPTIONS containing nextLink=path, the server returns nextLink as a path relative to the host root, with no leading slash: tables/<table>?$skip=50&$top=50.

Other clients keep receiving the current query-only format, so there is no breaking change.

Proposed change

In TableController.Query.cs:

  • Add IsLegacyClient(HttpRequest). It returns true when the X-ZUMO-OPTIONS header contains nextLink=path (case-insensitive).
  • Change CreateNextLink(...) to take a bool legacyClient parameter.
    • If it's false, return the query string (TrimStart('?')) as before.
    • If it's true, return (request.PathBase + request.Path).Value.Trim('/') + queryString.
  • Compute legacyClient once in QueryAsync and pass it to CreateNextLink.

What platforms?

  • Server:

    • Version of dotnet being used to compile: .NET 10
    • Library versions: CommunityToolkit.Datasync.Server 10.2.0
  • Client:

    • Platform: Wpf
    • Version of dotnet being used to compile: .NET 9
    • .NET Runtime Environment: .NET 9
    • Datasync Toolkit NuGet versions: v6 client

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Requires TriageThis issue has not been checked by the project team.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions