Fix translating URL encoded mentions of sim users

This commit is contained in:
Cadence Ember 2024-01-06 19:00:57 +13:00
parent e4f66a5077
commit 83070dcf7e
2 changed files with 34 additions and 1 deletions

View file

@ -448,7 +448,8 @@ async function eventToMessage(event, guild, di) {
}
// Handling mentions of Discord users
input = input.replace(/("https:\/\/matrix.to\/#\/(@[^"]+)")>/g, (whole, attributeValue, mxid) => {
input = input.replace(/("https:\/\/matrix.to\/#\/((?:@|%40)[^"]+)")>/g, (whole, attributeValue, mxid) => {
mxid = decodeURIComponent(mxid)
if (mxUtils.eventSenderIsFromDiscord(mxid)) {
// Handle mention of an OOYE sim user by their mxid
const userID = select("sim", "user_id", {mxid: mxid}).pluck().get()