mirror of
https://codeberg.org/git-pages/git-pages.git
synced 2026-05-14 11:11:35 +00:00
Return status 413 Request Entity Too Large where appropriate.
This commit is contained in:
@@ -432,6 +432,12 @@ func ServePages(w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, strings.ReplaceAll(message, "\n", "\n- "), authErr.code)
|
||||
err = errors.New(strings.ReplaceAll(message, "\n", "; "))
|
||||
}
|
||||
var tooLargeErr *http.MaxBytesError
|
||||
if errors.As(err, &tooLargeErr) {
|
||||
message := "request body too large"
|
||||
http.Error(w, message, http.StatusRequestEntityTooLarge)
|
||||
err = errors.New(message)
|
||||
}
|
||||
log.Println("pages err:", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user