1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-09-16 08:56:19 +02:00

Making error handling more precise in the server (and fixing tests)

This commit is contained in:
Jesús Espino
2022-04-06 10:35:26 +02:00
parent 140af2e52f
commit e2648f516a

View File

@@ -1779,7 +1779,12 @@ func (a *API) handleUploadFile(w http.ResponseWriter, r *http.Request) {
file, handle, err := r.FormFile(UploadFormFileKey)
if err != nil {
a.errorResponse(w, r.URL.Path, http.StatusRequestEntityTooLarge, "", err)
fmt.Println(err.Error())
if strings.HasSuffix(err.Error(), "http: request body too large") {
a.errorResponse(w, r.URL.Path, http.StatusRequestEntityTooLarge, "", err)
return
}
a.errorResponse(w, r.URL.Path, http.StatusBadRequest, "", err)
return
}
defer file.Close()