From 09696d9fdb966409af1c2f43833cb6b93948efbc Mon Sep 17 00:00:00 2001 From: Samuel Leutner Date: Fri, 16 May 2025 17:57:24 -0300 Subject: [PATCH] Fix: Prevent raw HTML rendering in notifications Notifications were occasionally displaying raw HTML content, including tags, instead of the intended plain text message. This commit introduces a regex to strip all HTML tags from notification content before display, ensuring a proper user experience. --- .config/ags/modules/.commonwidgets/notification.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.config/ags/modules/.commonwidgets/notification.js b/.config/ags/modules/.commonwidgets/notification.js index 8733aa117..b9486a2f0 100644 --- a/.config/ags/modules/.commonwidgets/notification.js +++ b/.config/ags/modules/.commonwidgets/notification.js @@ -39,12 +39,12 @@ function guessMessageType(summary) { } function processNotificationBody(body, appEntry) { - // Only process Chrome/Chromium notifications + let processedBody = body; if (appEntry?.toLowerCase().includes('chrome')) { - // Remove the first line - return body.split('\n\n').slice(1).join('\n\n'); + processedBody = body.split('\n\n').slice(1).join('\n\n'); } - return body; + processedBody = processedBody.replace(/<[^>]*>/g, ''); + return processedBody; } const getFriendlyNotifTimeString = (timeObject) => {