Skip to content

Commit

Permalink
Don't abort listing tags when we encounter a digest
Browse files Browse the repository at this point in the history
Per containers/skopeo#2346, that happens
in the wild.

Signed-off-by: Miloslav Trmač <[email protected]>
  • Loading branch information
mtrmac committed Jun 3, 2024
1 parent 9b62272 commit 7eeb9ee
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docker/docker_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/containers/image/v5/manifest"
"github.com/containers/image/v5/types"
"github.com/opencontainers/go-digest"
"github.com/sirupsen/logrus"
)

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

0 comments on commit 7eeb9ee

Please sign in to comment.