From 206fc2f5cabad7d3b4700833df5883e271bc5ed2 Mon Sep 17 00:00:00 2001 From: Mathias Date: Thu, 1 Oct 2026 19:28:10 +0200 Subject: [PATCH] feat(web): log upload rejections by reason only Co-Authored-By: Claude Sonnet 5.5 --- internal/web/uploads.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/web/uploads.go b/internal/web/uploads.go index bd65624..1f5e90c 100644 --- a/internal/web/uploads.go +++ b/internal/web/uploads.go @@ -111,12 +111,15 @@ func (a *App) uploadFailure(w http.ResponseWriter, r *http.Request, userID strin var tooBig *http.MaxBytesError switch { case errors.As(err, &rej): + // Logged by reason only: the filename and title are private content. + a.logger().Info("upload rejected", "reason", string(rej.Reason)) status := http.StatusUnprocessableEntity if rej.Reason == uploads.ReasonTooLarge { status = http.StatusRequestEntityTooLarge } a.renderUploadsPage(w, r, userID, status, rej.Message) case errors.As(err, &tooBig): + a.logger().Info("upload rejected", "reason", string(uploads.ReasonTooLarge)) a.renderUploadsPage(w, r, userID, http.StatusRequestEntityTooLarge, "This file is larger than the upload limit.") default: