#173: render friendly 'Paste ID not found' UI instead of bare 404

Missing/expired/burned paste IDs and unknown routes now render the main
UI (topbar + centered result card) with a 'Paste ID not found' message,
returning HTTP 404 status for correctness.
This commit is contained in:
fen
2026-09-10 11:06:44 -05:00
parent 5dba356264
commit 9712926cf5
3 changed files with 57 additions and 7 deletions
+6 -3
View File
@@ -129,9 +129,12 @@ func (a *apiServer) routes() http.Handler {
r.Get("/{id}", a.handlePasteView)
r.Post("/{id}", a.handlePasteView)
r.NotFound(func(w http.ResponseWriter, r *http.Request) {
writeErr(w, 404, "not found")
})
// #173: missing paste URLs render the main UI with a friendly not-found
// message instead of a bare JSON 404. Known routes (above) handle real pages;
// anything else is a nonexistent paste ID or typo.
r.NotFound(func(w http.ResponseWriter, r *http.Request) {
a.webHandlers().HandleNotFoundPage(w, r)
})
return r
}