From 8ff0eb53cb7bc1e38ce784ce71e44d03e0210af3 Mon Sep 17 00:00:00 2001 From: Miloslav Trmač Date: Thu, 19 Jul 2018 01:15:02 +0200 Subject: Use the result of reference.Parse when checking for digests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No need to do a separate string search when reference.Parse has already determined this. Changes behavior: non-SHA256 digest formats are now recognized as well. Signed-off-by: Miloslav Trmač Closes: #1112 Approved by: rhatdan --- libpod/image/parts.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'libpod') diff --git a/libpod/image/parts.go b/libpod/image/parts.go index bfc708ad7..127f723a8 100644 --- a/libpod/image/parts.go +++ b/libpod/image/parts.go @@ -2,7 +2,6 @@ package image import ( "fmt" - "strings" "github.com/containers/image/docker/reference" ) @@ -31,7 +30,7 @@ func decompose(input string) (imageParts, error) { ntag, isTagged := imgRef.(reference.NamedTagged) if !isTagged { tag = "latest" - if strings.Contains(input, "@sha256:") { + if _, hasDigest := imgRef.(reference.Digested); hasDigest { tag = "none" } } else { -- cgit v1.2.3-54-g00ecf