1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-06-27 16:36:00 +00:00

perf(sanitizer): remove two useless calls to strings.ReplaceAll

The [strings.Fields](https://pkg.go.dev/strings#Fields) considers `'\t', '\n',
'\v', '\f', '\r', ' ', U+0085 (NEL), U+00A0 (NBSP).` as spaces, so no need to
remove them beforehand.

This is a continuation of f2f60a8f73
This commit is contained in:
jvoisin 2025-02-17 01:26:15 +01:00 committed by Frédéric Guillot
parent f7e30822c3
commit 4a77e937af

View file

@ -7,8 +7,6 @@ import "strings"
func TruncateHTML(input string, max int) string {
text := StripTags(input)
text = strings.ReplaceAll(text, "\n", " ")
text = strings.ReplaceAll(text, "\t", " ")
// Collapse multiple spaces into a single space
text = strings.Join(strings.Fields(text), " ")