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:
commit
b9d08e9d56
|
@ -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]
|
||||
|
||||
|
|
Loading…
Reference in New Issue