Skip to content

Commit edcf253

Browse files
mtrmacTomSweeneyRedHat
authored andcommitted
Don't abort listing tags when we encounter a digest
Per containers/skopeo#2346, that happens in the wild. Signed-off-by: Miloslav Trmač <[email protected]> Signed-off-by: tomsweeneyredhat <[email protected]>
1 parent 2281641 commit edcf253

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docker/docker_image.go

+9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/containers/image/v5/manifest"
1515
"github.com/containers/image/v5/types"
1616
"github.com/opencontainers/go-digest"
17+
"github.com/sirupsen/logrus"
1718
)
1819

1920
// Image is a Docker-specific implementation of types.ImageCloser with a few extra methods
@@ -90,6 +91,14 @@ func GetRepositoryTags(ctx context.Context, sys *types.SystemContext, ref types.
9091
}
9192
for _, tag := range tagsHolder.Tags {
9293
if _, err := reference.WithTag(dr.ref, tag); err != nil { // Ensure the tag does not contain unexpected values
94+
// Per https://github.com/containers/skopeo/issues/2346 , unknown versions of JFrog Artifactory,
95+
// contrary to the tag format specified in
96+
// https://github.com/opencontainers/distribution-spec/blob/8a871c8234977df058f1a14e299fe0a673853da2/spec.md?plain=1#L160 ,
97+
// include digests in the list.
98+
if _, err := digest.Parse(tag); err == nil {
99+
logrus.Debugf("Ignoring invalid tag %q matching a digest format", tag)
100+
continue
101+
}
93102
return nil, fmt.Errorf("registry returned invalid tag %q: %w", tag, err)
94103
}
95104
tags = append(tags, tag)

0 commit comments

Comments
 (0)