From b960840197fe5883b79840eac900a874bb3cddbd Mon Sep 17 00:00:00 2001 From: Avinash Sridhar Date: Sun, 25 May 2025 22:05:18 -0400 Subject: [PATCH] fix(publish): handle inline model corectly on publish --- internal/api/handlers/v0/publish.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/api/handlers/v0/publish.go b/internal/api/handlers/v0/publish.go index 8d8f066..9e999d5 100644 --- a/internal/api/handlers/v0/publish.go +++ b/internal/api/handlers/v0/publish.go @@ -38,8 +38,13 @@ func PublishHandler(registry service.RegistryService, authService auth.Service) } // Get server details from the request - serverDetail := publishReq.ServerDetail + var serverDetail model.ServerDetail + err = json.Unmarshal(body, &serverDetail) + if err != nil { + http.Error(w, "Invalid server detail payload: "+err.Error(), http.StatusBadRequest) + return + } // Validate required fields if serverDetail.Name == "" { http.Error(w, "Name is required", http.StatusBadRequest)