Mohammed Nafees 3 anos atrás
pai
commit
10243fb9ac
1 arquivos alterados com 11 adições e 9 exclusões
  1. 11 9
      api/server/handlers/helmrepo/update.go

+ 11 - 9
api/server/handlers/helmrepo/update.go

@@ -51,7 +51,17 @@ func (p *HelmRepoUpdateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request
 		return
 	}
 
-	if helmRepo.BasicAuthIntegrationID != 0 {
+	request := &types.CreateUpdateHelmRepoRequest{}
+
+	ok := p.DecodeAndValidate(w, r, request)
+
+	if !ok {
+		return
+	}
+
+	if request.BasicIntegrationID != 0 &&
+		helmRepo.BasicAuthIntegrationID != 0 &&
+		request.BasicIntegrationID != helmRepo.BasicAuthIntegrationID {
 		bi, err := p.Repo().BasicIntegration().ReadBasicIntegration(proj.ID, helmRepo.BasicAuthIntegrationID)
 
 		if err != nil {
@@ -69,14 +79,6 @@ func (p *HelmRepoUpdateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request
 		}
 	}
 
-	request := &types.CreateUpdateHelmRepoRequest{}
-
-	ok := p.DecodeAndValidate(w, r, request)
-
-	if !ok {
-		return
-	}
-
 	// if a basic integration is specified, verify that it exists in the project
 	if request.BasicIntegrationID != 0 {
 		_, err := p.Repo().BasicIntegration().ReadBasicIntegration(proj.ID, request.BasicIntegrationID)