1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-07-22 17:18:37 +00:00

fix(sanitizer): MathML tags are not fully supported by golang.org/x/net/html

See https://github.com/golang/net/blob/master/html/atom/gen.go
and https://github.com/golang/net/blob/master/html/atom/table.go
This commit is contained in:
Frédéric Guillot 2025-05-06 21:09:57 -07:00
parent d1dc369bb2
commit 828a4334db
2 changed files with 20 additions and 2 deletions

View file

@ -82,7 +82,7 @@ var (
"annotation": {},
"annotation-xml": {},
"maction": {},
"math": {},
"math": {"xmlns"},
"merror": {},
"mfrac": {},
"mi": {},
@ -131,7 +131,15 @@ func Sanitize(baseURL, input string) string {
}
token := tokenizer.Token()
tagName := token.DataAtom.String()
// Note: MathML elements are not fully supported by golang.org/x/net/html.
// See https://github.com/golang/net/blob/master/html/atom/gen.go
// and https://github.com/golang/net/blob/master/html/atom/table.go
tagName := token.Data
if tagName == "" {
continue
}
switch token.Type {
case html.TextToken:
if len(blockedStack) > 0 {