소스 검색

Remove leading spaces of username when login

When we run `docker login` we will be asked to input our username.

Prior to this PR, "userA" and " userA" will be considered as two
diferrent user, which is not right.

Signed-off-by: Hu Keping <hukeping@huawei.com>
Hu Keping 10 년 전
부모
커밋
2687502ba4
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      api/client/commands.go

+ 1 - 0
api/client/commands.go

@@ -344,6 +344,7 @@ func (cli *DockerCli) CmdLogin(args ...string) error {
 	if username == "" {
 		promptDefault("Username", authconfig.Username)
 		username = readInput(cli.in, cli.out)
+		username = strings.Trim(username, " ")
 		if username == "" {
 			username = authconfig.Username
 		}