diff --git a/pkg/downloader/manager.go b/pkg/downloader/manager.go index 5272d7452..2b7d3e40a 100644 --- a/pkg/downloader/manager.go +++ b/pkg/downloader/manager.go @@ -744,7 +744,7 @@ func (m *Manager) findChartURL(name, version, repoURL, repoName string, repos ma var ve *repo.ChartVersion ve, err = findVersionedEntry(version, entry) if err == nil { - url, err = repo.ResolveReferenceURL(repoURL, ve.URLs[0]) + url, err = repo.ResolveReferenceURL(cr.Config.URL, ve.URLs[0]) if err == nil { username = cr.Config.Username password = cr.Config.Password diff --git a/pkg/downloader/manager_test.go b/pkg/downloader/manager_test.go index f68a35c4c..0b1c4db9a 100644 --- a/pkg/downloader/manager_test.go +++ b/pkg/downloader/manager_test.go @@ -202,9 +202,12 @@ repositories: t.Fatal(err) } + // Find with repo-alias-1 and a repoURL that differs from cr.Config.URL + // (no trailing slash vs with trailing slash). Should still resolve correctly + // because it uses cr.Config.URL as the base for relative chart URLs. + repoURL := "http://example.com/charts" name := "alpine" version := "0.1.0" - repoURL := "http://example.com/charts" // Look up by repo-alias-1 name -> should get user1/pass1 churl, username, password, _, passCredentialsAll, _, _, _, err := m.findChartURL(name, version, repoURL, "repo-alias-1", repos)