Fix: validate repo when modify url

Signed-off-by: LiHui <andrewli@yunify.com>
This commit is contained in:
LiHui
2021-04-19 16:36:22 +08:00
parent 37c53db57f
commit 77f6c9067d
2 changed files with 14 additions and 4 deletions

View File

@@ -201,8 +201,12 @@ func (h *openpitrixHandler) ModifyRepo(req *restful.Request, resp *restful.Respo
err = h.openpitrix.ModifyRepo(repoId, &updateRepoRequest)
if err != nil {
klog.Errorln(err)
handleOpenpitrixError(resp, err)
klog.Error(err)
if apierrors.IsNotFound(err) {
api.HandleNotFound(resp, nil, err)
return
}
api.HandleBadRequest(resp, nil, err)
return
} else {
klog.V(4).Info("modify repo: ", repoId)