commit 6c5de388e5a73f1cbda64ae090f0bdd7ad39bf38
Author: Wim <wim@42.be>
Date: Sun Feb 17 21:48:32 2019 +0000
diff --git a/bridge/matrix/matrix.go b/bridge/matrix/matrix.go
index e26cf23..f76c4ab 100644
--- a/bridge/matrix/matrix.go
+++ b/bridge/matrix/matrix.go
@@ -2011 +2013 @@ type Bmatrix struct {
UserID string
RoomMap map[string]string
sync.RWMutex
+ htmlTag *regexp.Regexp
*bridge.Config
}
func New(cfg *bridge.Config) bridge.Bridger {
b := &Bmatrix{Config: cfg}
+ b.htmlTag = regexp.MustCompile("</.*?>")
b.RoomMap = make(map[string]string)
return b
}
@@ -1228 +12413 @@ func (b *Bmatrix) Send(msg config.Message) (string, error) {
return resp.EventID, err
}
+ username := html.EscapeString(msg.Username)
+ // check if we have a </tag>. if we have, we don't escape HTML. #696
+ if b.htmlTag.MatchString(msg.Username) {
+ username = msg.Username
+ }
// Post normal message with HTML support (eg riot.im)
- resp, err := b.mc.SendHTML(channel, msg.Username+msg.Text, html.EscapeString(msg.Username)+helper.ParseMarkdown(msg.Text))
+ resp, err := b.mc.SendHTML(channel, msg.Username+msg.Text, username+helper.ParseMarkdown(msg.Text))
if err != nil {
return "", err
}