fix(web): decode all HTML entities via html.UnescapeString (N11)

This commit is contained in:
sausheong committed 2026-06-13 12:50:07 +08:00
1 parent 373e44b9c7
commit e133f97e1e
2 files changed
+10 -6

No files matched your search

+2 -6
View File
@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"html"
"io"
"net/http"
"net/url"
@@ -271,11 +272,6 @@ func cleanHTMLText(s string) string {
}
}
result := out.String()
result = strings.ReplaceAll(result, "&", "&")
result = strings.ReplaceAll(result, "&lt;", "<")
result = strings.ReplaceAll(result, "&gt;", ">")
result = strings.ReplaceAll(result, "&quot;", `"`)
result = strings.ReplaceAll(result, "&#x27;", "'")
result = strings.ReplaceAll(result, "&nbsp;", " ")
result = html.UnescapeString(result)
return strings.TrimSpace(result)
}