From 9fc4551fdf3506b6d217e5a1c07a1d02308e12d5 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Fri, 27 Oct 2023 15:24:15 +0200 Subject: [PATCH] cloudapi: check upload targets in request validation It is now valid for UploadOptions to be nil but only if there is at least one UploadTarget defined. --- internal/cloudapi/v2/handler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/cloudapi/v2/handler.go b/internal/cloudapi/v2/handler.go index 3865a78c7..be7fef966 100644 --- a/internal/cloudapi/v2/handler.go +++ b/internal/cloudapi/v2/handler.go @@ -237,7 +237,7 @@ func (h *apiHandlers) PostCompose(ctx echo.Context) error { } var irTargets []*target.Target - if ir.UploadOptions == nil { + if ir.UploadOptions == nil && (ir.UploadTargets == nil || len(*ir.UploadTargets) == 0) { // nowhere to put the image, this is a user error if request.Koji == nil { return HTTPError(ErrorJSONUnMarshallingError)