From bd754a054c73a6c6dc4d342cda0a0ecdd4ce96d0 Mon Sep 17 00:00:00 2001 From: Scott Rigby Date: Wed, 12 Jan 2022 17:42:52 -0500 Subject: [PATCH] Bring exact version check logic from IndexFile.Get into registry tag check Signed-off-by: Scott Rigby --- internal/experimental/registry/util.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/experimental/registry/util.go b/internal/experimental/registry/util.go index dc4133ac146..8c6eb19581d 100644 --- a/internal/experimental/registry/util.go +++ b/internal/experimental/registry/util.go @@ -54,6 +54,14 @@ func GetTagMatchingVersionOrConstraint(tags []string, versionString string) (str // If string is empty, set wildcard constraint constraint, _ = semver.NewConstraint("*") } else { + // when customer input exact version, check whether have exact match + // one first + for _, v := range tags { + if versionString == v { + return v, nil + } + } + // Otherwise set constraint to the string given var err error constraint, err = semver.NewConstraint(versionString)