Skip to content

Commit

Permalink
Merge pull request moby#10423 from dmcgowan/v2-registry-fix-single-names
Browse files Browse the repository at this point in the history
Allow single name component repository names
  • Loading branch information
tiborvass committed Mar 9, 2015
2 parents 5cbe682 + a0ca919 commit 02e0a23
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions registry/v2/regexp.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import "regexp"
// separated by one period, dash or underscore.
var RepositoryNameComponentRegexp = regexp.MustCompile(`[a-z0-9]+(?:[._-][a-z0-9]+)*`)

// RepositoryNameRegexp builds on RepositoryNameComponentRegexp to allow 2 to
// RepositoryNameRegexp builds on RepositoryNameComponentRegexp to allow 1 to
// 5 path components, separated by a forward slash.
var RepositoryNameRegexp = regexp.MustCompile(`(?:` + RepositoryNameComponentRegexp.String() + `/){1,4}` + RepositoryNameComponentRegexp.String())
var RepositoryNameRegexp = regexp.MustCompile(`(?:` + RepositoryNameComponentRegexp.String() + `/){0,4}` + RepositoryNameComponentRegexp.String())

// TagNameRegexp matches valid tag names. From docker/docker:graph/tags.go.
var TagNameRegexp = regexp.MustCompile(`[\w][\w.-]{0,127}`)
8 changes: 8 additions & 0 deletions registry/v2/routes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ func TestRouter(t *testing.T) {
RequestURI: "/v2/",
Vars: map[string]string{},
},
{
RouteName: RouteNameManifest,
RequestURI: "/v2/foo/manifests/bar",
Vars: map[string]string{
"name": "foo",
"tag": "bar",
},
},
{
RouteName: RouteNameManifest,
RequestURI: "/v2/foo/bar/manifests/tag",
Expand Down

0 comments on commit 02e0a23

Please sign in to comment.