From fb79dbb0453834c3efa698d538a3ddf6c583d55b Mon Sep 17 00:00:00 2001 From: Mathias Date: Fri, 2 Oct 2026 16:40:55 +0200 Subject: [PATCH] fix(uploads.go): an error reaches the log, the row and the page as a kind, never its text (adversarial review F3, F5) Co-Authored-By: Claude Sonnet 5.5 --- internal/web/uploads.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/web/uploads.go b/internal/web/uploads.go index 28601fe..9b4d8e2 100644 --- a/internal/web/uploads.go +++ b/internal/web/uploads.go @@ -17,6 +17,7 @@ import ( "git.d-ma.be/mathias/tapir/internal/adapters/chat" "git.d-ma.be/mathias/tapir/internal/adapters/store" "git.d-ma.be/mathias/tapir/internal/domain" + "git.d-ma.be/mathias/tapir/internal/errkind" "git.d-ma.be/mathias/tapir/internal/uploads" ) @@ -134,7 +135,9 @@ func (a *App) uploadFailure(w http.ResponseWriter, r *http.Request, userID strin a.renderUploadsPage(w, r, userID, http.StatusRequestEntityTooLarge, "This file is larger than the upload limit.") default: - a.serverError(w, r, "upload", err) + // Not err: it can carry the file's name, a spool path or a database value. + a.logger().Error("upload failed", "kind", errkind.Of(err)) + http.Error(w, "internal error", http.StatusInternalServerError) } } @@ -261,7 +264,7 @@ func (a *App) handleUploadChatMessage(w http.ResponseWriter, r *http.Request) { MaxChars: a.UploadChatMaxChars, }) if err != nil { - a.logger().Error("upload chat answer", "upload", u.ID, "model", model, "err", err) + a.logger().Error("upload chat answer", "upload", u.ID, "model", model, "kind", errkind.Of(err)) view.Error = "That model couldn't answer just now. Try again, or switch models." } else { view.History = appendTurn(history, chat.Turn{Question: question, Answer: reply.Answer})