API: Add batch edit form validation error to gin.Context #271

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2025-07-10 09:06:11 +02:00
parent 02ef7dbdee
commit 6bfbad40af
2 changed files with 6 additions and 2 deletions

View File

@@ -102,7 +102,11 @@ func AbortUnexpectedError(c *gin.Context) {
Abort(c, http.StatusInternalServerError, i18n.ErrUnexpected) Abort(c, http.StatusInternalServerError, i18n.ErrUnexpected)
} }
func AbortBadRequest(c *gin.Context) { func AbortBadRequest(c *gin.Context, errs ...error) {
for _, err := range errs {
_ = c.Error(err)
}
Abort(c, http.StatusBadRequest, i18n.ErrBadRequest) Abort(c, http.StatusBadRequest, i18n.ErrBadRequest)
} }

View File

@@ -44,7 +44,7 @@ func BatchPhotosEdit(router *gin.RouterGroup) {
// Assign and validate request form values. // Assign and validate request form values.
if err := c.BindJSON(&frm); err != nil { if err := c.BindJSON(&frm); err != nil {
AbortBadRequest(c) AbortBadRequest(c, err)
return return
} }