Fix regex filters to match complete string.

If someone specifies

  service = "foo-service"

...they probably don't want it to match:

  service = "foo-servicebar"
This commit is contained in:
Julius Volz 2013-07-19 13:31:12 +02:00
parent 648a79a3e1
commit a8bd98b7e1
1 changed files with 2 additions and 2 deletions

View File

@ -33,8 +33,8 @@ func NewFilter(namePattern string, valuePattern string) *Filter {
fmt.Fprintf(summer, namePattern, valuePattern)
return &Filter{
Name: regexp.MustCompile(namePattern),
Value: regexp.MustCompile(valuePattern),
Name: regexp.MustCompile("^" + namePattern + "$"),
Value: regexp.MustCompile("^" + valuePattern + "$"),
fingerprint: summer.Sum64(),
}
}