1
0
mirror of https://github.com/louislam/uptime-kuma.git synced 2024-12-12 10:13:46 +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) .randomBytes(size)
.toString('base64') .toString('base64')
.slice(0, size); .slice(0, size);
const roomId = notification
.internalRoomId
.replaceALl(":", "%3A")
.replaceAll("!", "%21");
try { try {
let config = { let config = {
@ -25,7 +29,7 @@ class Matrix extends NotificationProvider {
"body": msg "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; return okMsg;
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);