mirror of
https://github.com/distribution/distribution.git
synced 2025-09-24 12:37:00 +00:00
Allow uppercase characters in hostnames
This allows hostnames to contain uppercase characters, matching behavior in Docker versions before 1.10. It does not attempt to canonicalize hostnames into a lowercase format before parsing, since this could lead to corner cases (for example, making Hostname.Domain.Com/ref ambiguous on a daemon which contains references for both hostname.domain.com/ref and Hostname.Domain.Com/ref). Fixes: #1433 Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
This commit is contained in:
@@ -111,6 +111,10 @@ func TestHostRegexp(t *testing.T) {
|
||||
input: "xn--n3h.com", // ☃.com in punycode
|
||||
match: true,
|
||||
},
|
||||
{
|
||||
input: "Asdf.com", // uppercase character
|
||||
match: true,
|
||||
},
|
||||
}
|
||||
r := regexp.MustCompile(`^` + hostnameRegexp.String() + `$`)
|
||||
for i := range hostcases {
|
||||
@@ -399,6 +403,14 @@ func TestFullNameRegexp(t *testing.T) {
|
||||
match: true,
|
||||
subs: []string{"registry.io", "foo/project--id.module--name.ver---sion--name"},
|
||||
},
|
||||
{
|
||||
input: "Asdf.com/foo/bar", // uppercase character in hostname
|
||||
match: true,
|
||||
},
|
||||
{
|
||||
input: "Foo/FarB", // uppercase characters in remote name
|
||||
match: false,
|
||||
},
|
||||
}
|
||||
for i := range testcases {
|
||||
checkRegexp(t, anchoredNameRegexp, testcases[i])
|
||||
|
Reference in New Issue
Block a user