Do not allow version with digest

Signed-off-by: Terry Howe <terrylhowe@gmail.com>
pull/12690/head
Terry Howe 1 month ago
parent 17db610c53
commit 771fe87723

@ -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 != "" {

Loading…
Cancel
Save