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:
parent
f7e30822c3
commit
4a77e937af
1 changed files with 0 additions and 2 deletions
|
@ -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), " ")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue