feat(web): log upload rejections by reason only

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 19:28:10 +02:00
co-authored by Claude Sonnet 5.5
parent 5368d5f8c2
commit 206fc2f5ca
+3
View File
@@ -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: