From bddb411a3d27dd74fb94140f0eb1bb8c686a464f Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Tue, 10 Feb 2026 20:51:23 -0500 Subject: [PATCH] fix: add validation for empty media_item_id in bulk update Add strict validation to return 400 Bad Request when any media_item_id is empty in the bulk-update request, rather than treating it as a partial failure with 200 OK. This aligns the handler behavior with test expectations for the BulkUpdateBooks_EmptyBookIDs test case. --- internal/handlers/media.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/handlers/media.go b/internal/handlers/media.go index b6c748d..90de33f 100644 --- a/internal/handlers/media.go +++ b/internal/handlers/media.go @@ -439,6 +439,12 @@ func (h *MediaHandler) HandleBulkUpdate(c echo.Context) error { return c.JSON(http.StatusBadRequest, map[string]string{"error": "media_item_updates required"}) } + for _, update := range req.MediaItemUpdates { + if update.MediaItemID == "" { + return c.JSON(http.StatusBadRequest, map[string]string{"error": "media_item_id cannot be empty"}) + } + } + results := make([]map[string]interface{}, 0) successCount := 0 failedCount := 0