...
|
...
|
@@ -17,6 +17,7 @@ import (
|
17
|
17
|
"os"
|
18
|
18
|
"path/filepath"
|
19
|
19
|
"reflect"
|
|
20
|
+ "regexp"
|
20
|
21
|
"strconv"
|
21
|
22
|
"strings"
|
22
|
23
|
"text/tabwriter"
|
...
|
...
|
@@ -641,6 +642,10 @@ func (cli *DockerCli) CmdPush(args ...string) error {
|
641
|
641
|
if len(strings.SplitN(name, "/", 2)) == 1 {
|
642
|
642
|
return fmt.Errorf("Impossible to push a \"root\" repository. Please rename your repository in <user>/<repo> (ex: %s/%s)", out.Username, name)
|
643
|
643
|
}
|
|
644
|
+ validRepo := regexp.MustCompile(`^([a-z0-9]{4,30})/([a-z0-9-.]+)$`)
|
|
645
|
+ if !validRepo.MatchString(name) {
|
|
646
|
+ return fmt.Errorf("Invalid repository name, only alphanum, - and . are allowed")
|
|
647
|
+ }
|
644
|
648
|
|
645
|
649
|
v := url.Values{}
|
646
|
650
|
v.Set("registry", *registry)
|