From 771fe87723b86deec7acf91ce05086de892187bf Mon Sep 17 00:00:00 2001 From: Terry Howe Date: Sun, 2 Jun 2024 07:56:52 -0600 Subject: [PATCH] Do not allow version with digest Signed-off-by: Terry Howe --- pkg/registry/util.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/registry/util.go b/pkg/registry/util.go index 8e388fbf2..12d5d49b0 100644 --- a/pkg/registry/util.go +++ b/pkg/registry/util.go @@ -31,6 +31,7 @@ import ( ocispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "github.com/sirupsen/logrus" + errdef "oras.land/oras-go/pkg/content" orascontext "oras.land/oras-go/pkg/context" "oras.land/oras-go/pkg/registry" @@ -135,6 +136,9 @@ func parseReference(raw string) (registry.Reference, error) { } parts := strings.Split(raw, ":") if len(parts) > 1 && !strings.Contains(parts[len(parts)-1], "/") { + if len(digest) > 0 { + return registry.Reference{}, fmt.Errorf("%w: specify digest or version", errdef.ErrInvalidReference) + } tag := parts[len(parts)-1] if tag != "" {