Release v0.4.0: dev -> main #251
@@ -299,3 +299,27 @@ func TestNotFound(t *testing.T) {
|
||||
t.Fatalf("expected 404, got %d", rec.Code)
|
||||
}
|
||||
}
|
||||
|
||||
// #173: a missing paste ID on the UI route (/p/{id}, i.e. /{id} HTML view)
|
||||
// should render the main UI page with a friendly "Paste ID not found"
|
||||
// message, not a bare text 404. Status stays 404.
|
||||
func TestPasteViewNotFoundFriendly(t *testing.T) {
|
||||
s := testServer(t)
|
||||
h := s.routes()
|
||||
req := httptest.NewRequest("GET", "/zzzzzz", nil)
|
||||
rec := httptest.NewRecorder()
|
||||
h.ServeHTTP(rec, req)
|
||||
if rec.Code != http.StatusNotFound {
|
||||
t.Fatalf("expected 404 status, got %d", rec.Code)
|
||||
}
|
||||
body := rec.Body.String()
|
||||
if !strings.Contains(body, "Paste ID not found") {
|
||||
t.Fatalf("expected friendly message in body, got: %.200s", body)
|
||||
}
|
||||
if !strings.Contains(body, "<nav>") {
|
||||
t.Fatalf("expected main UI chrome in body")
|
||||
}
|
||||
if strings.Contains(body, "404 page not found") {
|
||||
t.Fatalf("body still contains bare Go 404 text")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,6 +341,9 @@ td a.slug.paste-name { background: none; padding: 0; border-radius: 0; font-fami
|
||||
}
|
||||
.inner h1 { font-size: 29.2px; font-weight: 600; margin-bottom: 6px; }
|
||||
.inner .sub { font-size: 22.4px; color: var(--muted-fg); margin-bottom: 20px; }
|
||||
/* #173: missing paste message box */
|
||||
.notfound-err { color: var(--err); }
|
||||
.notfound-card .btn { display: block; margin-top: 10px; }
|
||||
.pwinput {
|
||||
width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius);
|
||||
background: var(--bg); color: var(--fg); font: inherit; font-size: 23.2px; outline: none; text-align: center;
|
||||
|
||||
Reference in New Issue
Block a user