update deps; experiment: log security

This commit is contained in:
Aine
2022-11-16 23:00:58 +02:00
parent 225ba2ee9b
commit 99a89ef87a
55 changed files with 883 additions and 308 deletions

View File

@@ -138,9 +138,13 @@ func (content *MessageEventContent) SetEdit(original id.EventID) {
}
}
func TextToHTML(text string) string {
return strings.ReplaceAll(html.EscapeString(text), "\n", "<br/>")
}
func (content *MessageEventContent) EnsureHasHTML() {
if len(content.FormattedBody) == 0 || content.Format != FormatHTML {
content.FormattedBody = strings.ReplaceAll(html.EscapeString(content.Body), "\n", "<br/>")
content.FormattedBody = TextToHTML(content.Body)
content.Format = FormatHTML
}
}