forked from TrueCloudLab/distribution
allow dot in repo name
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
This commit is contained in:
parent
c7c51058ce
commit
4bc3522500
2 changed files with 9 additions and 7 deletions
|
@ -101,17 +101,12 @@ func ResolveRepositoryName(reposName string) (string, string, error) {
|
|||
return "", "", ErrInvalidRepositoryName
|
||||
}
|
||||
nameParts := strings.SplitN(reposName, "/", 2)
|
||||
if !strings.Contains(nameParts[0], ".") && !strings.Contains(nameParts[0], ":") &&
|
||||
nameParts[0] != "localhost" {
|
||||
if len(nameParts) == 1 || (!strings.Contains(nameParts[0], ".") && !strings.Contains(nameParts[0], ":") &&
|
||||
nameParts[0] != "localhost") {
|
||||
// This is a Docker Index repos (ex: samalba/hipache or ubuntu)
|
||||
err := validateRepositoryName(reposName)
|
||||
return IndexServerAddress(), reposName, err
|
||||
}
|
||||
if len(nameParts) < 2 {
|
||||
// There is a dot in repos name (and no registry address)
|
||||
// Is it a Registry address without repos name?
|
||||
return "", "", ErrInvalidRepositoryName
|
||||
}
|
||||
hostname := nameParts[0]
|
||||
reposName = nameParts[1]
|
||||
if strings.Contains(hostname, "index.docker.io") {
|
||||
|
|
|
@ -146,6 +146,13 @@ func TestResolveRepositoryName(t *testing.T) {
|
|||
}
|
||||
assertEqual(t, ep, u, "Expected endpoint to be "+u)
|
||||
assertEqual(t, repo, "private/moonbase", "Expected endpoint to be private/moonbase")
|
||||
|
||||
ep, repo, err = ResolveRepositoryName("ubuntu-12.04-base")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
assertEqual(t, ep, IndexServerAddress(), "Expected endpoint to be "+IndexServerAddress())
|
||||
assertEqual(t, repo, "ubuntu-12.04-base", "Expected endpoint to be ubuntu-12.04-base")
|
||||
}
|
||||
|
||||
func TestPushRegistryTag(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue