normalizeTaggedDigestedString strips the tag off the specified string iff it is tagged and digested. Note that the tag is entirely ignored to match Docker behavior.
(s string)
| 139 | // is tagged and digested. Note that the tag is entirely ignored to match |
| 140 | // Docker behavior. |
| 141 | func normalizeTaggedDigestedString(s string) (string, error) { |
| 142 | // Note that the input string is not expected to be parseable, so we |
| 143 | // return it verbatim in error cases. |
| 144 | ref, err := reference.Parse(s) |
| 145 | if err != nil { |
| 146 | return "", err |
| 147 | } |
| 148 | named, ok := ref.(reference.Named) |
| 149 | if !ok { |
| 150 | return s, nil |
| 151 | } |
| 152 | named, err = normalizeTaggedDigestedNamed(named) |
| 153 | if err != nil { |
| 154 | return "", err |
| 155 | } |
| 156 | return named.String(), nil |
| 157 | } |
| 158 | |
| 159 | // normalizeTaggedDigestedNamed strips the tag off the specified named |
| 160 | // reference iff it is tagged and digested. Note that the tag is entirely |
searching dependent graphs…