Skip to content

Commit 09ee257

Browse files
authored
Merge pull request #471 from openSUSE/tag-digest-fix
Fallback to repo digest name if repoTag is <none>:<none>
2 parents 0bc8dc4 + caa3b0e commit 09ee257

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

cmd/crictl/image.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,9 @@ func getAuth(creds string, auth string) (*pb.AuthConfig, error) {
402402
// Ideally repo tag should always be image:tag.
403403
// The repoTags is nil when pulling image by repoDigest,Then we will show image name instead.
404404
func normalizeRepoTagPair(repoTags []string, imageName string) (repoTagPairs [][]string) {
405+
const none = "<none>"
405406
if len(repoTags) == 0 {
406-
repoTagPairs = append(repoTagPairs, []string{imageName, "<none>"})
407+
repoTagPairs = append(repoTagPairs, []string{imageName, none})
407408
return
408409
}
409410
for _, repoTag := range repoTags {
@@ -412,7 +413,11 @@ func normalizeRepoTagPair(repoTags []string, imageName string) (repoTagPairs [][
412413
repoTagPairs = append(repoTagPairs, []string{"errorRepoTag", "errorRepoTag"})
413414
continue
414415
}
415-
repoTagPairs = append(repoTagPairs, []string{repoTag[:idx], repoTag[idx+1:]})
416+
name := repoTag[:idx]
417+
if name == none {
418+
name = imageName
419+
}
420+
repoTagPairs = append(repoTagPairs, []string{name, repoTag[idx+1:]})
416421
}
417422
return
418423
}

0 commit comments

Comments
 (0)