Skip to content

Commit 559be9d

Browse files
committed
fix: escape special characters in notification options
1 parent 76a4560 commit 559be9d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/integrations/notifications/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ export async function showSystemNotification(options: NotificationOptions): Prom
7878
throw new Error("Message is required")
7979
}
8080

81+
const escape = (str: string = "") => str.replace(/\\/g, "\\\\").replace(/"/g, '\\"')
8182
const escapedOptions = {
8283
...options,
83-
title: title.replace(/"/g, '\\"'),
84-
message: message.replace(/"/g, '\\"'),
85-
subtitle: options.subtitle?.replace(/"/g, '\\"') || "",
84+
title: escape(title),
85+
message: escape(message),
86+
subtitle: escape(options.subtitle),
8687
}
8788

8889
switch (platform()) {

0 commit comments

Comments
 (0)