Merge pull request #4385 from rickard-von-essen/issue-4383

docker: Fix crash when performing log in to ECR with an invalid URL.
This commit is contained in:
Matthew Hooker 2017-01-11 11:37:37 -08:00 committed by GitHub
commit b9d08e9d56
1 changed files with 3 additions and 0 deletions

View File

@ -52,6 +52,9 @@ func (c *AwsAccessConfig) EcrGetLogin(ecrUrl string) (string, string, error) {
exp := regexp.MustCompile("(?:http://|https://|)([0-9]*)\\.dkr\\.ecr\\.(.*)\\.amazonaws\\.com.*")
splitUrl := exp.FindStringSubmatch(ecrUrl)
if len(splitUrl) != 3 {
return "", "", fmt.Errorf("Failed to parse the ECR URL: %s it should be on the form <account number>.dkr.ecr.<region>.amazonaws.com", ecrUrl)
}
accountId := splitUrl[1]
region := splitUrl[2]