Skip to content

Commit 694a007

Browse files
author
zounengren
committed
replace deprecated function
Signed-off-by: Zou Nengren <[email protected]>
1 parent f40df65 commit 694a007

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

reference/docker/reference.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,13 @@ func WithDigest(name Named, digest digest.Digest) (Canonical, error) {
338338

339339
// TrimNamed removes any tag or digest from the named reference.
340340
func TrimNamed(ref Named) Named {
341-
domain, path := SplitHostname(ref)
342-
return repository{
343-
domain: domain,
344-
path: path,
341+
repo := repository{}
342+
if r, ok := ref.(namedRepository); ok {
343+
repo.domain, repo.path = r.Domain(), r.Path()
344+
} else {
345+
repo.domain, repo.path = splitDomain(ref.Name())
345346
}
347+
return repo
346348
}
347349

348350
func getBestReferenceType(ref reference) Reference {

0 commit comments

Comments
 (0)