404: the account pages and the auth guard still return an empty-bodied 404 #139

Stängd
öppnade 2026-08-01 14:21:17 +00:00 av supernaut · 0 kommentarer
Ägare

Follow-up to #134, which fixed the same bug shape in the [slug] routes but scoped to those.

new Response(null, { status: 404 }) sends a null body, so the browser gets a 404 with nothing to
render — worse than the framework default the issue set out to replace. #134 rewrote the four guide and
news slug routes to the branded page. Three places still return an empty-bodied 404:

  • src/pages/account.astro:18
  • src/pages/en/account.astro:18
  • src/lib/auth/guard.ts:25 and :42

account.astro is the straightforward half — the same Astro.rewrite(getRelativeLocaleUrl(lang, "/404"))
the slug routes now use.

guard.ts is the awkward one and is why this was not just folded into #134: it returns bare Response
objects from a library function, so it has no Astro context and no language. Fixing it properly means
either threading the context in or having the guard signal "not found" and letting the page decide how
to render it — a small interface decision rather than a mechanical edit.

Done when

No route in the repository returns a 404 with an empty body, and a reader who hits one on the account
pages sees the branded page in their own language.

Follow-up to #134, which fixed the same bug shape in the `[slug]` routes but scoped to those. `new Response(null, { status: 404 })` sends a **null body**, so the browser gets a 404 with nothing to render — worse than the framework default the issue set out to replace. #134 rewrote the four guide and news slug routes to the branded page. Three places still return an empty-bodied 404: - `src/pages/account.astro:18` - `src/pages/en/account.astro:18` - `src/lib/auth/guard.ts:25` and `:42` `account.astro` is the straightforward half — the same `Astro.rewrite(getRelativeLocaleUrl(lang, "/404"))` the slug routes now use. `guard.ts` is the awkward one and is why this was not just folded into #134: it returns bare `Response` objects from a library function, so it has no `Astro` context and no language. Fixing it properly means either threading the context in or having the guard signal "not found" and letting the page decide how to render it — a small interface decision rather than a mechanical edit. ## Done when No route in the repository returns a 404 with an empty body, and a reader who hits one on the account pages sees the branded page in their own language.
supernaut lade till detta till projektet Bitborg Web 2026-08-01 14:22:02 +00:00
Logga in för att delta i denna konversation.
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-web#139
Ingen beskrivning angiven.