Skip to content

fix(next-routing): denormalize data URLs in standalone dynamic route check#91620

Draft
haltandcatchwater wants to merge 1 commit intovercel:canaryfrom
haltandcatchwater:fix/resolve-routes-data-url-denormalization
Draft

fix(next-routing): denormalize data URLs in standalone dynamic route check#91620
haltandcatchwater wants to merge 1 commit intovercel:canaryfrom
haltandcatchwater:fix/resolve-routes-data-url-denormalization

Conversation

@haltandcatchwater
Copy link

What?

Replaces the inline dynamic route matching loop after afterFiles processing with a call to the existing checkDynamicRoutes helper.

Why?

The standalone dynamic route check (after afterFiles routes are exhausted) used an inline loop that matched against currentUrl.pathname directly. However, by the time execution reaches this point, the URL may still be in its normalized data URL form — it was re-normalized at line 700 for afterFiles processing and never denormalized back if no afterFiles route matched.

The checkDynamicRoutes helper already handles this correctly: it conditionally denormalizes data URLs before matching (lines 307-310). This helper is already used for the equivalent dynamic route checks inside both the afterFiles loop (line 762) and the fallback loop (line 929), making this the only dynamic route matching site that was missing the denormalization step.

Without this fix, dynamic routes with has/missing conditions could silently fail to match when reached via the standalone path with a data URL request.

How?

Replaced the 51-line inline loop with a call to checkDynamicRoutes, matching the exact pattern already established at the afterFiles and fallback call sites. The replacement is structurally identical — same arguments, same post-call handling (resetUrl propagation, status merge).

Test plan

  • Existing resolve-routes unit tests pass
  • Data URL requests that fall through afterFiles without matching now correctly denormalize before dynamic route matching

…e matching

The standalone dynamic route check after afterFiles processing used an
inline loop that did not denormalize data URLs before matching. The
checkDynamicRoutes helper, which is already used for the afterFiles and
fallback code paths, handles this correctly via its denormalization
preamble. Replace the inline loop with a call to checkDynamicRoutes to
fix potential silent match failures for data URLs on this path.
@nextjs-bot
Copy link
Collaborator

Allow CI Workflow Run

  • approve CI run for commit: ca028b4

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

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.

2 participants