From ab376134b95be0e809c5f171db63cba41380c881 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Fri, 9 Sep 2022 10:22:51 -0800 Subject: [PATCH] handle parse form error --- backend/app/api/v1/v1_ctrl_items.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/app/api/v1/v1_ctrl_items.go b/backend/app/api/v1/v1_ctrl_items.go index 9233e95..3c2cf28 100644 --- a/backend/app/api/v1/v1_ctrl_items.go +++ b/backend/app/api/v1/v1_ctrl_items.go @@ -154,7 +154,12 @@ func (ctrl *V1Controller) HandleItemsImport() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // Max upload size of 10 MB - TODO: Set via config - r.ParseMultipartForm(10 << 20) + err := r.ParseMultipartForm(10 << 20) + if err != nil { + log.Err(err).Msg("failed to parse multipart form") + server.RespondServerError(w) + return + } file, _, err := r.FormFile("csv") if err != nil {