Commit Graph

1 Commits

Author SHA1 Message Date
James Anderson 51a63131b5 test(pages-router): regression coverage for URL-encoded CSS paths (#1472) (#1675)
Adds focused tests verifying that the static-asset layer serves CSS
files when the browser percent-encodes special characters in the path:

* `tests/serve-static.test.ts` — three cases against `tryServeStatic`:
  the cache fast path with an encoded URL, the slow path with an
  encoded URL, and the literal-character pathname that the request
  pipeline produces after `normalizePathnameForRouteMatchStrict` runs.

* `tests/pages-css-url-encoding.test.ts` — full build-and-serve test
  for the Pages Router that imports `my@style.css` and `with space.css`
  from `pages/index.tsx`, then asserts every emitted stylesheet link
  resolves to a 200 after `encodeURI` is applied (matching browser
  behaviour).

All three tests pass against the current implementation: `tryServeStatic`
decodes percent-encoded pathnames before cache lookup, and the cache
indexes files by their literal on-disk names. These tests document the
contract and guard against future regressions.

Refs cloudflare/vinext#1472
2026-05-28 20:09:27 +01:00