Fix double escaped lyrics and comments
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"html"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/kennygrant/sanitize"
|
||||
"github.com/microcosm-cc/bluemonday"
|
||||
)
|
||||
|
||||
var quotesRegex = regexp.MustCompile("[“”‘’'\"\\[\\(\\{\\]\\)\\}]")
|
||||
@@ -29,3 +31,10 @@ func SanitizeStrings(text ...string) string {
|
||||
sort.Strings(fullText)
|
||||
return strings.Join(fullText, " ")
|
||||
}
|
||||
|
||||
var policy = bluemonday.UGCPolicy()
|
||||
|
||||
func SanitizeText(text string) string {
|
||||
s := policy.Sanitize(text)
|
||||
return html.UnescapeString(s)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user