From 559be9d5b979dede08aecec884579ba13fc34883 Mon Sep 17 00:00:00 2001 From: NaccOll Date: Tue, 12 Aug 2025 15:26:43 +0800 Subject: [PATCH] fix: escape special characters in notification options --- src/integrations/notifications/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/integrations/notifications/index.ts b/src/integrations/notifications/index.ts index 8d236b9142..ef59d1e4a2 100644 --- a/src/integrations/notifications/index.ts +++ b/src/integrations/notifications/index.ts @@ -78,11 +78,12 @@ export async function showSystemNotification(options: NotificationOptions): Prom throw new Error("Message is required") } + const escape = (str: string = "") => str.replace(/\\/g, "\\\\").replace(/"/g, '\\"') const escapedOptions = { ...options, - title: title.replace(/"/g, '\\"'), - message: message.replace(/"/g, '\\"'), - subtitle: options.subtitle?.replace(/"/g, '\\"') || "", + title: escape(title), + message: escape(message), + subtitle: escape(options.subtitle), } switch (platform()) {