Skip to content

Commit 99923b7

Browse files
committed
Escape HTML tags in Notifications (Linux)
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
1 parent 05148b6 commit 99923b7

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎src/vector/platform/ElectronPlatform.js‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ export default class ElectronPlatform extends VectorBasePlatform {
8181
}
8282

8383
displayNotification(title: string, msg: string, avatarUrl: string, room: Object): Notification {
84+
85+
// GNOME notification spec parses HTML tags for styling...
86+
// Electron Docs state all supported linux notification systems follow this markup spec
87+
// https://github.com/electron/electron/blob/master/docs/tutorial/desktop-environment-integration.md#linux
88+
// maybe we should pass basic styling (italics, bold, underline) through from MD
89+
if (window.process.platform === 'linux') {
90+
msg = msg.replace(/</g, "&lt;").replace(/>/g, "&gt;");
91+
}
92+
8493
// Notifications in Electron use the HTML5 notification API
8594
const notification = new global.Notification(
8695
title,

0 commit comments

Comments
 (0)