From 99e8a331184e0dffdf70e500fe729dc133e04768 Mon Sep 17 00:00:00 2001 From: Gero Gerke Date: Tue, 5 Oct 2021 21:36:01 +0200 Subject: [PATCH] escape room characters --- server/notification-providers/matrix.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/notification-providers/matrix.js b/server/notification-providers/matrix.js index 581218ea7..24d45239e 100644 --- a/server/notification-providers/matrix.js +++ b/server/notification-providers/matrix.js @@ -13,6 +13,10 @@ class Matrix extends NotificationProvider { .randomBytes(size) .toString('base64') .slice(0, size); + const roomId = notification + .internalRoomId + .replaceALl(":", "%3A") + .replaceAll("!", "%21"); try { let config = { @@ -25,7 +29,7 @@ class Matrix extends NotificationProvider { "body": msg }; - await axios.put(`${notification.homeserverUrl}/_matrix/client/r0/rooms/${notification.internalRoomId}/send/m.room.message/${randomString}`, data, config) + await axios.put(`${notification.homeserverUrl}/_matrix/client/r0/rooms/${roomId}/send/m.room.message/${randomString}`, data, config) return okMsg; } catch (error) { this.throwGeneralAxiosError(error);