Commit Graph

2 Commits

Author SHA1 Message Date
Nathan Nguyen 7e721b3e53 fix(app-router): preserve semicolons in redirect digests (#2487)
* fix(app-router): preserve raw redirect digest URLs

Redirect digests can carry raw URLs, and raw URLs can contain semicolons. Treating semicolon-delimited URL content as digest structure can truncate or misclassify the redirect target.

Keep redirect digest parsing strict about the final status segment while preserving semicolons in the URL. The server parser stays self-contained so App Router startup does not import the navigation shim.

* fix: simplify malformed redirect digest fallback

* fix: simplify malformed redirect digest fallback

* test: cover malformed redirect digest tails consistently

* fix: restore unstable rethrow cause handling

* fix: guard decodeURIComponent throw and comment status allowlist

- Wrap decodeURIComponent in try/catch for malformed lone % in raw URLs
- Add clarifying comment that only canonical 303/307/308 are extracted
- Both address ask-bonk review feedback from PR #2487

* fix(app-router): preserve raw redirect digest URLs

* fix(app-router): support empty redirect destinations

* docs(app-router): explain redirect digest formats

* docs(app-router): clarify redirect digest parsing

* test(app-router): cover redirect digest re-emission

* docs(app-router): document redirect parser invariants

---------

Co-authored-by: James <james@eli.cx>
2026-07-08 10:55:33 +01:00
Nathan Nguyen 2e6d2b75c7 fix(app-router): preserve omitted redirect type context (#1172)
redirect() without an explicit type currently reaches shared digest parsing as an empty sentinel, but the parser resolves that sentinel to push before non-action callers can apply their own default. That makes SSR and route-handler redirect handling inherit the Server Action history behavior.

Preserve the omitted type as null at the digest boundary and resolve it to push only when packaging Server Action redirects. Add focused parser coverage for omitted, explicit, and non-empty raw type segments.
2026-05-12 14:08:37 +01:00