MCPcopy Create free account
hub / github.com/containers/image / ParseNormalizedNamed

Function ParseNormalizedNamed

docker/reference/normalize.go:32–56  ·  view source on GitHub ↗

ParseNormalizedNamed parses a string into a named reference transforming a familiar name from Docker UI to a fully qualified reference. If the value may be an identifier use ParseAnyReference.

(s string)

Source from the content-addressed store, hash-verified

30// qualified reference. If the value may be an identifier
31// use ParseAnyReference.
32func ParseNormalizedNamed(s string) (Named, error) {
33 if ok := anchoredIdentifierRegexp.MatchString(s); ok {
34 return nil, fmt.Errorf("invalid repository name (%s), cannot specify 64-byte hexadecimal strings", s)
35 }
36 domain, remainder := splitDockerDomain(s)
37 var remoteName string
38 if tagSep := strings.IndexRune(remainder, ':'); tagSep > -1 {
39 remoteName = remainder[:tagSep]
40 } else {
41 remoteName = remainder
42 }
43 if strings.ToLower(remoteName) != remoteName {
44 return nil, errors.New("invalid reference format: repository name must be lowercase")
45 }
46
47 ref, err := Parse(domain + "/" + remainder)
48 if err != nil {
49 return nil, err
50 }
51 named, isNamed := ref.(Named)
52 if !isNamed {
53 return nil, fmt.Errorf("reference %s has no name", ref.String())
54 }
55 return named, nil
56}
57
58// ParseDockerRef normalizes the image reference following the docker convention. This is added
59// mainly for backward compatibility.

Callers 15

TestCreateSignaturesFunction · 0.92
ResolveFunction · 0.92
ResolveLocallyFunction · 0.92
parseShortNameValueFunction · 0.92
ParseStoreReferenceMethod · 0.92
TestNewReferenceFunction · 0.92
imageMatchesRepoFunction · 0.92

Calls 3

splitDockerDomainFunction · 0.85
ParseFunction · 0.85
StringMethod · 0.65

Used in the wild real call sites across dependent graphs

searching dependent graphs…