Use the result of reference.Parse when checking for digests.

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č <mitr@redhat.com>

Closes: #1112
Approved by: rhatdan
This commit is contained in:
Miloslav Trmač 2018-07-19 01:15:02 +02:00 committed by Atomic Bot
parent 38842bd407
commit 8ff0eb53cb
1 changed files with 1 additions and 2 deletions

View File

@ -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 {