From 79fe60e6fb2d3aa1a5389f50b1840503cd3b723d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 20 Feb 2010 04:28:47 +0100 Subject: [PATCH] [messageTray] Fix text with ampersands not being displayed If the notification body contains '&' it ends up empty and a warning about an invalid entity is printed on stderr, so our escape code must handle ampersands as well. https://bugzilla.gnome.org/show_bug.cgi?id=607375 --- js/ui/messageTray.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 039685a1c..06dd250bb 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -27,9 +27,12 @@ const State = { }; function _cleanMarkup(text) { + // Support &, ", ', < and >, escape all other + // occurrences of '&'. + let _text = text.replace(/&(?!amp;|quot;|apos;|lt;|gt;)/g, "&"); // Support , , and , escape anything else // so it displays as raw markup. - return text.replace(/<(\/?[^biu]>|[^>\/][^>])/g, "<$1"); + return _text.replace(/<(\/?[^biu]>|[^>\/][^>])/g, "<$1"); } // Notification: @@ -295,7 +298,6 @@ Notification.prototype = { popIn: function() { if (this.actor.row_count <= 1) return false; - Tweener.addTween(this._bannerLabel, { opacity: 255, time: ANIMATION_TIME,