1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-07-02 16:38:37 +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
parent 462ba8d7f7
commit 8d006c8615

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), " ")