fix(attachments): return error message when attachment upload is not multipart form request

Resolves https://vikunja.sentry.io/issues/6041469388/
This commit is contained in:
kolaente 2024-11-04 12:26:45 +01:00
parent 9e987a89d4
commit 4556cfb057
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B
1 changed files with 4 additions and 0 deletions

View File

@ -17,6 +17,7 @@
package v1
import (
"errors"
"net/http"
"strings"
@ -72,6 +73,9 @@ func UploadTaskAttachment(c echo.Context) error {
form, err := c.MultipartForm()
if err != nil {
_ = s.Rollback()
if errors.Is(err, http.ErrNotMultipart) {
return echo.NewHTTPError(http.StatusBadRequest, "No multipart form provided")
}
return handler.HandleHTTPError(err)
}