// ParseIDOrReference parses string for an image ID or a reference. ID can be // without a default prefix. func ParseIDOrReference(idOrRef string) (digest.Digest, Named, error) { if err := stringid.ValidateID(idOrRef); err == nil { idOrRef = "sha256:" + idOrRef } if dgst, err := digest.ParseDigest(idOrRef); err == nil { return dgst, nil, nil } ref, err := ParseNamed(idOrRef) return "", ref, err }
// ValidateID checks whether an ID string is a valid image ID. func ValidateID(id string) error { return stringid.ValidateID(id) }
func validateName(name string) error { if err := stringid.ValidateID(name); err == nil { return fmt.Errorf("Invalid repository name (%s), cannot specify 64-byte hexadecimal strings", name) } return nil }