summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-06-11 10:27:59 -0400
committerGitHub <noreply@github.com>2020-06-11 10:27:59 -0400
commitf1b6840382ffdfe9811c64b3aea75218d9b14e5e (patch)
tree1629a9aa470c3f8dbc3bd52fdbfa656caf533f3e
parent142e62cb45e54a0e77b598c76886e5cff0cdbb45 (diff)
parent3218736cff4b718b8fe855759687cb66f19d6e1e (diff)
downloadpodman-f1b6840382ffdfe9811c64b3aea75218d9b14e5e.tar.gz
podman-f1b6840382ffdfe9811c64b3aea75218d9b14e5e.tar.bz2
podman-f1b6840382ffdfe9811c64b3aea75218d9b14e5e.zip
Merge pull request #6516 from zhangguanzhang/master
fix api fails with 'strconv.ParseUint: parsing "tcp": invalid syntax'
-rw-r--r--pkg/api/handlers/compat/containers.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go
index b90f3d625..8ce2180ab 100644
--- a/pkg/api/handlers/compat/containers.go
+++ b/pkg/api/handlers/compat/containers.go
@@ -465,8 +465,11 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON,
ports := make(nat.PortSet)
for p := range inspect.HostConfig.PortBindings {
- splitp := strings.Split(p, "/")
- port, err := nat.NewPort(splitp[0], splitp[1])
+ splitp := strings.SplitN(p, "/", 2)
+ if len(splitp) != 2 {
+ return nil, errors.Errorf("PORT/PROTOCOL Format required for %q", p)
+ }
+ port, err := nat.NewPort(splitp[1], splitp[0])
if err != nil {
return nil, err
}