summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-02-13 19:20:10 +0100
committerGitHub <noreply@github.com>2019-02-13 19:20:10 +0100
commit8a16f83b0a13ab9de1cc905a3ff1132c75739995 (patch)
treecbaa3fe4b37fe03eda5c01f298da55cea95c6f53 /libpod
parent62d88558e7637b72ea9ef53d1b3a2d08f2c6a51e (diff)
parentf29a11c201a67a82ca2b82d314a57043207aa1ac (diff)
downloadpodman-8a16f83b0a13ab9de1cc905a3ff1132c75739995.tar.gz
podman-8a16f83b0a13ab9de1cc905a3ff1132c75739995.tar.bz2
podman-8a16f83b0a13ab9de1cc905a3ff1132c75739995.zip
Merge pull request #2327 from baude/issue2175
Parse fq name correctly for images
Diffstat (limited to 'libpod')
-rw-r--r--libpod/image/utils.go17
1 files changed, 12 insertions, 5 deletions
diff --git a/libpod/image/utils.go b/libpod/image/utils.go
index ad027f32a..3585428ad 100644
--- a/libpod/image/utils.go
+++ b/libpod/image/utils.go
@@ -87,22 +87,29 @@ func hasTransport(image string) bool {
// ReposToMap parses the specified repotags and returns a map with repositories
// as keys and the corresponding arrays of tags as values.
-func ReposToMap(repotags []string) map[string][]string {
+func ReposToMap(repotags []string) (map[string][]string, error) {
// map format is repo -> tag
repos := make(map[string][]string)
for _, repo := range repotags {
var repository, tag string
if len(repo) > 0 {
- li := strings.LastIndex(repo, ":")
- repository = repo[0:li]
- tag = repo[li+1:]
+ named, err := reference.ParseNormalizedNamed(repo)
+ repository = named.Name()
+ if err != nil {
+ return nil, err
+ }
+ if ref, ok := named.(reference.NamedTagged); ok {
+ tag = ref.Tag()
+ } else if ref, ok := named.(reference.Canonical); ok {
+ tag = ref.Digest().String()
+ }
}
repos[repository] = append(repos[repository], tag)
}
if len(repos) == 0 {
repos["<none>"] = []string{"<none>"}
}
- return repos
+ return repos, nil
}
// GetAdditionalTags returns a list of reference.NamedTagged for the