mirror of
https://github.com/docker/cli.git
synced 2026-01-16 20:22:36 +03:00
Merge pull request #2599 from dotcloud/prevent_panic_wrong_api_use
Prevent panic if you use API in a wrong way Upstream-commit: 997a32706f5169ac1a6a9c3e34d5eae58ca8017d Component: engine
This commit is contained in:
@@ -133,7 +133,11 @@ type PortBinding struct {
|
||||
type Port string
|
||||
|
||||
func (p Port) Proto() string {
|
||||
return strings.Split(string(p), "/")[1]
|
||||
parts := strings.Split(string(p), "/")
|
||||
if len(parts) == 1 {
|
||||
return "tcp"
|
||||
}
|
||||
return parts[1]
|
||||
}
|
||||
|
||||
func (p Port) Port() string {
|
||||
|
||||
Reference in New Issue
Block a user