diff --git a/registry/api/v2/names_test.go b/registry/api/v2/names_test.go index d1dd2b48..0975fb7c 100644 --- a/registry/api/v2/names_test.go +++ b/registry/api/v2/names_test.go @@ -73,6 +73,42 @@ func TestRepositoryNameRegexp(t *testing.T) { input: strings.Repeat("a", 256), err: ErrRepositoryNameLong, }, + { + input: "-foo/bar", + err: ErrRepositoryNameComponentInvalid, + }, + { + input: "foo/bar-", + err: ErrRepositoryNameComponentInvalid, + }, + { + input: "foo-/bar", + err: ErrRepositoryNameComponentInvalid, + }, + { + input: "foo/-bar", + err: ErrRepositoryNameComponentInvalid, + }, + { + input: "_foo/bar", + err: ErrRepositoryNameComponentInvalid, + }, + { + input: "foo/bar_", + err: ErrRepositoryNameComponentInvalid, + }, + { + input: "____/____", + err: ErrRepositoryNameComponentInvalid, + }, + { + input: "_docker/_docker", + err: ErrRepositoryNameComponentInvalid, + }, + { + input: "docker_/docker_", + err: ErrRepositoryNameComponentInvalid, + }, } { failf := func(format string, v ...interface{}) {