Bugfix: catch error from ParseConditions and refactor ParseConditions

Signed-off-by: Zhengyi Lai <zheng1@yunify.com>
This commit is contained in:
Zhengyi Lai
2020-08-10 13:53:31 +08:00
parent 114fad5eb0
commit 3c48abcc47
3 changed files with 215 additions and 24 deletions

View File

@@ -867,6 +867,12 @@ func (h *openpitrixHandler) ListRepos(req *restful.Request, resp *restful.Respon
reverse := params.GetBoolValueWithDefault(req, params.ReverseParam, false)
conditions, err := params.ParseConditions(req)
if err != nil {
klog.V(4).Infoln(err)
api.HandleBadRequest(resp, nil, err)
return
}
if req.PathParameter("workspace") != "" {
conditions.Match[openpitrix.WorkspaceLabel] = req.PathParameter("workspace")
}