From cef8cb0bbf445318fba1761e5ff3f959579dbfed Mon Sep 17 00:00:00 2001 From: git-bruh Date: Wed, 1 Dec 2021 11:58:38 +0530 Subject: [PATCH] pass decoded username to db query when looking for mentions --- appservice/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/appservice/main.py b/appservice/main.py index fa8f449..474c981 100644 --- a/appservice/main.py +++ b/appservice/main.py @@ -360,7 +360,10 @@ height=\"32\" src=\"{emote_}\" data-mx-emoticon />""", message = message.replace(f":{emote}:", emote_) for mention in set(mentions): - username = self.db.fetch_user(mention).get("username") + # Unquote just in-case we matched an encoded username. + username = self.db.fetch_user(urllib.parse.unquote(mention)).get( + "username" + ) if username: match = re.search(self.id_regex, mention)