1
0
mirror of https://github.com/louislam/uptime-kuma.git synced 2024-12-10 10:10:14 +02:00

escape room characters

This commit is contained in:
Gero Gerke 2021-10-05 21:36:01 +02:00
parent d7cc585101
commit 99e8a33118

View File

@ -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);