Merge pull request #5922 from zouyee/replace

replace deprecated function with Domain and Path
This commit is contained in:
Derek McGowan 2021-09-27 10:14:57 -07:00 committed by GitHub
commit 6416cc35c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -338,11 +338,13 @@ func WithDigest(name Named, digest digest.Digest) (Canonical, error) {
// TrimNamed removes any tag or digest from the named reference.
func TrimNamed(ref Named) Named {
domain, path := SplitHostname(ref)
return repository{
domain: domain,
path: path,
repo := repository{}
if r, ok := ref.(namedRepository); ok {
repo.domain, repo.path = r.Domain(), r.Path()
} else {
repo.domain, repo.path = splitDomain(ref.Name())
}
return repo
}
func getBestReferenceType(ref reference) Reference {