fix: allowing regex underscore for container registry enforcement

While not best practice, underscore can be used and so should be allowed.
This commit is contained in:
Tom OBrien
2021-10-27 20:55:39 +02:00
committed by Dario Tranchitella
parent 260b60d263
commit e361e2d424
@@ -54,7 +54,7 @@ func (r registry) Tag() string {
func NewRegistry(value string) Registry {
reg := make(registry)
r := regexp.MustCompile(`(((?P<registry>[a-zA-Z0-9-.]+)\/)?((?P<repository>[a-zA-Z0-9-.]+)\/))?(?P<image>[a-zA-Z0-9-.]+)(:(?P<tag>[a-zA-Z0-9-.]+))?`)
r := regexp.MustCompile(`(((?P<registry>[a-zA-Z0-9-._]+)\/)?((?P<repository>[a-zA-Z0-9-._]+)\/))?(?P<image>[a-zA-Z0-9-._]+)(:(?P<tag>[a-zA-Z0-9-._]+))?`)
match := r.FindStringSubmatch(value)
for i, name := range r.SubexpNames() {
if i > 0 && i <= len(match) {