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

Merge pull request #4751 from enokd/master

Fixes #3369 Repeated slash-'/' characters; harmonize across all name-related commands
This commit is contained in:
Michael Crosby 2014-03-24 17:43:02 -07:00
commit 4585d2da3e
2 changed files with 29 additions and 0 deletions

View file

@ -208,6 +208,15 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
}
// Upload the build context
v := &url.Values{}
//Check if the given image name can be resolved
if *tag != "" {
repository, _ := utils.ParseRepositoryTag(*tag)
if _, _, err := registry.ResolveRepositoryName(repository); err != nil {
return err
}
}
v.Set("t", *tag)
if *suppressOutput {
@ -1003,6 +1012,12 @@ func (cli *DockerCli) CmdImport(args ...string) error {
repository, tag = utils.ParseRepositoryTag(cmd.Arg(1))
}
v := url.Values{}
//Check if the given image name can be resolved
if _, _, err := registry.ResolveRepositoryName(repository); err != nil {
return err
}
v.Set("repo", repository)
v.Set("tag", tag)
v.Set("fromSrc", src)
@ -1453,6 +1468,11 @@ func (cli *DockerCli) CmdCommit(args ...string) error {
return nil
}
//Check if the given image name can be resolved
if _, _, err := registry.ResolveRepositoryName(repository); err != nil {
return err
}
v := url.Values{}
v.Set("container", name)
v.Set("repo", repository)
@ -1741,6 +1761,11 @@ func (cli *DockerCli) CmdTag(args ...string) error {
}
v := url.Values{}
//Check if the given image name can be resolved
if _, _, err := registry.ResolveRepositoryName(repository); err != nil {
return err
}
v.Set("repo", repository)
v.Set("tag", tag)

View file

@ -206,4 +206,8 @@ func TestValidRepositoryName(t *testing.T) {
t.Log("Repository name should be invalid")
t.Fail()
}
if err := validateRepositoryName("docker///docker"); err == nil {
t.Log("Repository name should be invalid")
t.Fail()
}
}