mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-20 10:33:41 -05:00
hicli/html: fix closing font tags in html sanitizer
This commit is contained in:
parent
475a57e3f5
commit
8d201642c8
2 changed files with 8 additions and 4 deletions
|
@ -469,10 +469,14 @@ Loop:
|
||||||
tagName, _ := tz.TagName()
|
tagName, _ := tz.TagName()
|
||||||
tag := atom.Lookup(tagName)
|
tag := atom.Lookup(tagName)
|
||||||
if tagIsAllowed(tag) && ts.pop(tag) {
|
if tagIsAllowed(tag) && ts.pop(tag) {
|
||||||
|
if tag == atom.Font {
|
||||||
|
built.WriteString("</span>")
|
||||||
|
} else {
|
||||||
built.WriteString("</")
|
built.WriteString("</")
|
||||||
built.Write(tagName)
|
built.Write(tagName)
|
||||||
built.WriteByte('>')
|
built.WriteByte('>')
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case html.TextToken:
|
case html.TextToken:
|
||||||
if ts.contains(atom.Pre, atom.Code, atom.A) {
|
if ts.contains(atom.Pre, atom.Code, atom.A) {
|
||||||
writeEscapedBytes(&built, tz.Text())
|
writeEscapedBytes(&built, tz.Text())
|
||||||
|
|
|
@ -356,7 +356,7 @@ func (h *HiClient) calculateLocalContent(ctx context.Context, dbEvt *database.Ev
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
const CurrentHTMLSanitizerVersion = 1
|
const CurrentHTMLSanitizerVersion = 2
|
||||||
|
|
||||||
func (h *HiClient) ReprocessExistingEvent(ctx context.Context, evt *database.Event) {
|
func (h *HiClient) ReprocessExistingEvent(ctx context.Context, evt *database.Event) {
|
||||||
if evt.Type != event.EventMessage.Type || evt.LocalContent == nil || evt.LocalContent.HTMLVersion >= CurrentHTMLSanitizerVersion {
|
if evt.Type != event.EventMessage.Type || evt.LocalContent == nil || evt.LocalContent.HTMLVersion >= CurrentHTMLSanitizerVersion {
|
||||||
|
|
Loading…
Add table
Reference in a new issue