fix(repo): make IndexFile.Has() match exact version

Change Has() function to check against the exact version (as described
in the docstring comment) instead of falling back to the semver
constraints business. Fixes index merge in cases where version numbers
are similar enough (but not identical), causing previous entries to be
inadvertently overwritten.

Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
pull/9553/head
Markus Lehtonen 5 years ago
parent 213a7df2dc
commit 06be566ef1

@ -154,8 +154,12 @@ func (i IndexFile) Add(md *chart.Metadata, filename, baseURL, digest string) {
// Has returns true if the index has an entry for a chart with the given name and exact version.
func (i IndexFile) Has(name, version string) bool {
_, err := i.Get(name, version)
return err == nil
for _, ver := range i.Entries[name] {
if version == ver.Version {
return true
}
}
return false
}
// SortEntries sorts the entries by version in descending order.

Loading…
Cancel
Save