[#2702] [GTKUI] Fix potential markup warning in Details Tab

* Comments with HTML markup cause a GTK markup warning.
 * Use cgi function to escape '&', '<' and '>' to prevent pango markup error.
This commit is contained in:
Calum Lind 2014-12-01 13:26:25 +00:00
parent 0ea6ad0669
commit 41f08e4e29

View File

@ -7,6 +7,7 @@
# See LICENSE for more details.
#
import cgi
import logging
import deluge.component as component
@ -94,10 +95,11 @@ class DetailsTab(Tab):
txt = status[widget[2][0]]
if widget[0].get_text() != txt:
if widget[2][0] == 'comment' and is_url(txt):
widget[0].set_markup('<a href="%s">%s</a>' % (txt, txt.replace('&', '&amp;')))
txt = cgi.escape(txt)
if widget[2][0] == "comment" and is_url(txt):
widget[0].set_markup('<a href="%s">%s</a>' % (txt, txt))
else:
widget[0].set_markup(txt.replace('&', '&amp;'))
widget[0].set_markup(txt)
def clear(self):
for widget in self.label_widgets: