lib/protoparser/graphite: use Regex.ReplaceAllLiteralString instead of Regex.ReplaceAllString for the case when the replacement cannot contain placeholders for capturing groups

This is a follow-up for 74affa3aec
This commit is contained in:
Aliaksandr Valialkin 2024-07-17 13:00:56 +02:00
parent 74affa3aec
commit 8ff051b287
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB

View file

@ -257,7 +257,7 @@ func stripLeadingWhitespace(s string) string {
var sanitizer = bytesutil.NewFastStringTransformer(func(s string) string { var sanitizer = bytesutil.NewFastStringTransformer(func(s string) string {
// Apply rule to drop some chars to preserve backwards compatibility // Apply rule to drop some chars to preserve backwards compatibility
s = repeatedDots.ReplaceAllString(s, ".") s = repeatedDots.ReplaceAllLiteralString(s, ".")
// Replace any remaining illegal chars // Replace any remaining illegal chars
return allowedChars.ReplaceAllLiteralString(s, "_") return allowedChars.ReplaceAllLiteralString(s, "_")