From b744bb23c3eba5679883a0e77bbcdf278e27d4b9 Mon Sep 17 00:00:00 2001 From: Hu Keping Date: Wed, 9 Sep 2015 19:29:19 +0800 Subject: [PATCH] Use TrimSpace to instead of Trim String.Trim(string, " ") can only get ride of the blank, but actully we need to remove all leading and trailing white space include "\t" for example. Prior to this patch, one can login with "[Tab][Tab]username", and it will not be consider as the same with "username". Signed-off-by: Hu Keping Upstream-commit: e9602f3561b78313c4d474a8d950f7cc562637e8 Component: engine --- components/engine/api/client/login.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/api/client/login.go b/components/engine/api/client/login.go index 68ec5c6d9c..7e3d73ca05 100644 --- a/components/engine/api/client/login.go +++ b/components/engine/api/client/login.go @@ -64,7 +64,7 @@ func (cli *DockerCli) CmdLogin(args ...string) error { if username == "" { promptDefault("Username", authconfig.Username) username = readInput(cli.in, cli.out) - username = strings.Trim(username, " ") + username = strings.TrimSpace(username) if username == "" { username = authconfig.Username }