File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,14 +89,12 @@ const (
8989 // are allowed, IPv6 zone identifiers (rfc6874) or Special addresses such as
9090 // IPv4-Mapped are deliberately excluded.
9191 ipv6address = `\[(?:[a-fA-F0-9:]+)\]`
92- )
9392
94- var (
9593 // domainName defines the structure of potential domain components
9694 // that may be part of image names. This is purposely a subset of what is
9795 // allowed by DNS to ensure backwards compatibility with Docker image
9896 // names. This includes IPv4 addresses on decimal format.
99- domainName = domainNameComponent + anyTimes ( ` \.`+ domainNameComponent )
97+ domainName = domainNameComponent + `(?: \.` + domainNameComponent + `)*`
10098
10199 // host defines the structure of potential domains based on the URI
102100 // Host subcomponent on rfc3986. It may be a subset of DNS domain name,
@@ -108,7 +106,9 @@ var (
108106 // allowed by the URI Host subcomponent on rfc3986 to ensure backwards
109107 // compatibility with Docker image names.
110108 domainAndPort = host + optionalPort
109+ )
111110
111+ var (
112112 // anchoredTagRegexp matches valid tag names, anchored at the start and
113113 // end of the matched string.
114114 anchoredTagRegexp = regexp .MustCompile (anchored (tag ))
Original file line number Diff line number Diff line change @@ -161,7 +161,10 @@ func TestDomainRegexp(t *testing.T) {
161161 match : false ,
162162 },
163163 }
164- r := regexp .MustCompile (`^` + DomainRegexp .String () + `$` )
164+ r , err := regexp .Compile (`^` + domainAndPort + `$` )
165+ if err != nil {
166+ t .Fatal (err )
167+ }
165168 for _ , tc := range tests {
166169 tc := tc
167170 t .Run (tc .input , func (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments