Skip to content

Fix trailing-slash redirect truncating query strings that contain a second ? - #17964

Merged
matthewp merged 3 commits into
mainfrom
factory/fix-17962
Sep 10, 2026
Merged

matthewp merged 3 commits into
mainfrom
factory/fix-17962

Conversation

@astro-factory

@astro-factory astro-factory Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Changes

  • Trailing-slash redirects in @astrojs/node standalone mode now preserve the full query string when it contains a literal ? (e.g. OAuth callbacks, return URLs like redirect=/x?y=1). Previously, fullUrl.split('?') split on every ?, and array destructuring silently dropped everything after the second one.
  • Replaces split('?') with indexOf('?') + slice() so only the first ? is used as the path/query separator, per RFC 3986 §3.4.

Testing

  • Added two regression test cases in packages/integrations/node/test/trailing-slash.test.ts: one for trailingSlash: 'never' and one for trailingSlash: 'always', each verifying that a Location header with a query string containing a second ? is preserved intact.

Docs

  • No docs update needed; this is a bug fix restoring spec-compliant behavior with no API changes.

Closes #17962

@astro-factory astro-factory Bot added the fix verified Reporter confirmed the triage bot fix works label Sep 10, 2026
@changeset-bot

changeset-bot Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ae69e15

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the pkg: integration Related to any renderer integration (scope) label Sep 10, 2026
@matthewp
matthewp merged commit 01395b8 into main Sep 10, 2026
24 checks passed
@matthewp
matthewp deleted the factory/fix-17962 branch September 10, 2026 14:18
@astrobot-houston astrobot-houston mentioned this pull request Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix verified Reporter confirmed the triage bot fix works pkg: integration Related to any renderer integration (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@astrojs/node: trailing-slash redirect drops part of a query string that contains a second ?

1 participant