From d3613d1ec0607dbba4da71e9ede36339e038d795 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 10 May 2023 14:56:24 +0300 Subject: [PATCH] Use helper methods for generating matrix.to URLs --- formatter_tag.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/formatter_tag.go b/formatter_tag.go index c392de1..b1744c5 100644 --- a/formatter_tag.go +++ b/formatter_tag.go @@ -263,9 +263,9 @@ func (r *discordTagHTMLRenderer) renderDiscordMention(w util.BufWriter, source [ switch node := n.(type) { case *astDiscordUserMention: if user := node.portal.bridge.GetUserByID(strconv.FormatInt(node.id, 10)); user != nil { - _, _ = fmt.Fprintf(w, `%[1]s`, user.MXID) + _, _ = fmt.Fprintf(w, `%s`, user.MXID.URI().MatrixToURL(), user.MXID) } else if puppet := node.portal.bridge.GetPuppetByID(strconv.FormatInt(node.id, 10)); puppet != nil { - _, _ = fmt.Fprintf(w, `%s`, puppet.MXID, puppet.Name) + _, _ = fmt.Fprintf(w, `%s`, puppet.MXID.URI().MatrixToURL(), puppet.Name) } return case *astDiscordRoleMention: @@ -281,7 +281,7 @@ func (r *discordTagHTMLRenderer) renderDiscordMention(w util.BufWriter, source [ }) if portal != nil { if portal.MXID != "" { - _, _ = fmt.Fprintf(w, `%s`, portal.MXID, portal.bridge.AS.HomeserverDomain, portal.Name) + _, _ = fmt.Fprintf(w, `%s`, portal.MXID.URI(portal.bridge.AS.HomeserverDomain).MatrixToURL(), portal.Name) } else { _, _ = w.WriteString(portal.Name) }