Skip to content

Query params double-decoded when path rewrites applied #1179

Description

@fuleinist

Problem: In
equestHandler.ts line 281 (added in v3.9.0 for Next.js 15.4+),
eq.url is reconstructed from a RoutingResult whose query values were decoded via
ew URLSearchParams() in convertToQuery(), but convertToQueryString() does not re-encode them. This causes double-decoding downstream when the URL is re-parsed — %26 (encoded &) becomes bare &, which then acts as a query parameter separator.

Solution: Either (a) use
ew URL(event.url).search to preserve original percent-encoding instead of the decode/re-encode round-trip, or (b) re-encode values in convertToQueryString() using encodeURIComponent() so the query string is valid when re-parsed.

Use case: Applications with special characters in query params (e.g., a course search app with department code I&C SCI, where %26 gets double-decoded to bare &, truncating tRPC httpBatchLink GET requests). Works on OpenNext 3.6.6, breaks on 3.9.0+.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions