feat(web): log upload rejections by reason only
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user