From e75b3477ce2acf8af49a13e8197401ee00bff459 Mon Sep 17 00:00:00 2001 From: TomSweeneyRedHat Date: Tue, 16 Oct 2018 17:58:12 -0400 Subject: Handle http/https in registry given to login/out Signed-off-by: TomSweeneyRedHat --- cmd/podman/common.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cmd/podman/common.go') diff --git a/cmd/podman/common.go b/cmd/podman/common.go index e342659ed..8ae1c9e0f 100644 --- a/cmd/podman/common.go +++ b/cmd/podman/common.go @@ -465,3 +465,11 @@ func getAuthFile(authfile string) string { } return os.Getenv("REGISTRY_AUTH_FILE") } + +// scrubServer removes 'http://' or 'https://' from the front of the +// server/registry string if either is there. This will be mostly used +// for user input from 'podman login' and 'podman logout'. +func scrubServer(server string) string { + server = strings.TrimPrefix(server, "https://") + return strings.TrimPrefix(server, "http://") +} -- cgit v1.2.3-54-g00ecf