MCPcopy
hub / github.com/containers/toolbox / ImageReferenceGetBasename

Function ImageReferenceGetBasename

src/pkg/utils/utils.go:574–589  ·  view source on GitHub ↗
(image string)

Source from the content-addressed store, hash-verified

572}
573
574func ImageReferenceGetBasename(image string) string {
575 var i int
576 if ImageReferenceHasDomain(image) {
577 i = strings.IndexRune(image, '/')
578 }
579
580 remainder := image[i:]
581 j := strings.IndexRune(remainder, ':')
582 if j == -1 {
583 j = len(remainder)
584 }
585
586 path := remainder[:j]
587 basename := filepath.Base(path)
588 return basename
589}
590
591func ImageReferenceGetDomain(image string) string {
592 if !ImageReferenceHasDomain(image) {

Calls 1

ImageReferenceHasDomainFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…