1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

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 <hukeping@huawei.com>
This commit is contained in:
Hu Keping 2015-09-09 19:29:19 +08:00
parent 6733962a2c
commit e9602f3561

View file

@ -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
}