rcm/submit: fix error handling

We were not correctly catching the case where more than one arch
or more than one image type was specified.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2020-03-22 21:51:39 +01:00 committed by msehnout
parent 8e5b79df96
commit 96b4850554

View file

@ -135,7 +135,7 @@ func (api *API) submit(writer http.ResponseWriter, request *http.Request, _ http
decoder := json.NewDecoder(request.Body)
decoder.DisallowUnknownFields()
err := decoder.Decode(&composeRequest)
if err != nil || len(composeRequest.Architectures) == 0 || len(composeRequest.Repositories) == 0 || len(composeRequest.ImageTypes) == 0 {
if err != nil || len(composeRequest.Architectures) != 1 || len(composeRequest.ImageTypes) != 1 || len(composeRequest.Repositories) == 0 {
writer.WriteHeader(http.StatusBadRequest)
errors := []string{}
if err != nil {