Skip to content

Commit a5fce38

Browse files
committed
pkg/reference: Spec.Digest(): inline SplitObject code
Inline the relevant code from SplitObject, as we're only interested in the digest portion. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 4214595 commit a5fce38

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

pkg/reference/reference.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,12 @@ func (r Spec) Hostname() string {
135135
// Digest returns the digest portion of the reference spec. This may be a
136136
// partial or invalid digest, which may be used to lookup a complete digest.
137137
func (r Spec) Digest() digest.Digest {
138-
_, dgst := SplitObject(r.Object)
139-
return dgst
138+
i := strings.Index(r.Object, "@")
139+
140+
if i < 0 {
141+
return ""
142+
}
143+
return digest.Digest(r.Object[i+1:])
140144
}
141145

142146
// String returns the normalized string for the ref.

0 commit comments

Comments
 (0)