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.
This commit is contained in:
Achilleas Koutsou 2023-10-27 15:24:15 +02:00 committed by Sanne Raymaekers
parent 5c95eb565c
commit 9fc4551fdf

View file

@ -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)