diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 021ca4cf6..56237c528 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -28,6 +28,7 @@ The :mod:`maindisplay` module provides the functionality to display screens and play multimedia within OpenLP. """ +import cgi import logging import os import sys @@ -239,15 +240,13 @@ class MainDisplay(Display): if self.height() != self.screen[u'size'].height() or \ not self.isVisible(): shrink = True - js = u'show_alert("%s", "%s")' % ( - text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"') - .replace(u'<', u'<').replace(u'>', u'>'), + js = u'show_alert("%s", "%s")' % (cgi.escape( + text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"')), u'top') else: shrink = False - js = u'show_alert("%s", "")' % ( - text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"') - .replace(u'<', u'<').replace(u'>', u'>')) + js = u'show_alert("%s", "")' % (cgi.escape( + text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))) height = self.frame.evaluateJavaScript(js) if shrink: if text: