Skip to content

Commit

Permalink
fix: loosen string check
Browse files Browse the repository at this point in the history
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
  • Loading branch information
blakepettersson committed Aug 9, 2023
1 parent 37998be commit dd529ec
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions reposerver/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -1195,8 +1195,12 @@ func helmTemplate(appPath string, repoRoot string, env *v1alpha1.Env, q *apiclie
// We do a sanity check here to give a nicer error message in case any of the Helm repositories are not permitted by
// the AppProject which the application is a part of
for _, repo := range helmRepos {
match := regexp.MustCompile(fmt.Sprintf("could not download (oci|https?)://%s", repo.Repo))
if (strings.Contains(err.Error(), "401 Unauthorized") || match.MatchString(err.Error())) && !isSourcePermitted(repo.Repo, q.ProjectSourceRepos) {
msg := err.Error()

chartCannotBeReached := strings.Contains(msg, "is not a valid chart repository or cannot be reached")
couldNotDownloadChart := strings.Contains(msg, "could not download")

if (chartCannotBeReached || couldNotDownloadChart) && !isSourcePermitted(repo.Repo, q.ProjectSourceRepos) {
reposNotPermitted = append(reposNotPermitted, repo.Repo)
}
}
Expand Down

0 comments on commit dd529ec

Please sign in to comment.