Skip to content

Commit

Permalink
fix(client.go): fixes premature index file download
Browse files Browse the repository at this point in the history
now when calling `AddOrUpdateChartRepo` the index file is downloaded
only when the repo is not already cached in storage.
  • Loading branch information
nxtcoder17 committed Jul 26, 2023
1 parent 8d0453a commit dc68a0b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,18 +175,18 @@ func (c *HelmClient) AddOrUpdateChartRepo(entry repo.Entry) error {

chartRepo.CachePath = c.Settings.RepositoryCache

if c.storage.Has(entry.Name) {
c.DebugLog("WARNING: repository name %q already exists", entry.Name)
return nil
}

if !registry.IsOCI(entry.URL) {
_, err = chartRepo.DownloadIndexFile()
if err != nil {
return err
}
}

if c.storage.Has(entry.Name) {
c.DebugLog("WARNING: repository name %q already exists", entry.Name)
return nil
}

c.storage.Update(&entry)
err = c.storage.WriteFile(c.Settings.RepositoryConfig, 0o644)
if err != nil {
Expand Down

0 comments on commit dc68a0b

Please sign in to comment.