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:
parent
d1dc369bb2
commit
828a4334db
2 changed files with 20 additions and 2 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue