← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~mahfiaz/openlp/bug-908197 into lp:openlp

 

mahfiaz has proposed merging lp:~mahfiaz/openlp/bug-908197 into lp:openlp.

Requested reviews:
  Jonathan Corwin (j-corwin)
Related bugs:
  Bug #908197 in OpenLP: "HTML tags not escaped in alert message"
  https://bugs.launchpad.net/openlp/+bug/908197

For more details, see:
https://code.launchpad.net/~mahfiaz/openlp/bug-908197/+merge/87133

Converts <> marks to &lt;&gt; and & to &amp; to make it impossible to insert HTML to alert message.
-- 
https://code.launchpad.net/~mahfiaz/openlp/bug-908197/+merge/87133
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py	2011-12-29 17:50:42 +0000
+++ openlp/core/ui/maindisplay.py	2011-12-30 13:02:28 +0000
@@ -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,13 +240,13 @@
         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'\\\"'),
+            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'\\\"'))
+            js = u'show_alert("%s", "")' % (cgi.escape(
+                text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"')))
         height = self.frame.evaluateJavaScript(js)
         if shrink:
             if text:


Follow ups