From 41f08e4e298712f7299dd550e081860fe21a50bc Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Mon, 1 Dec 2014 13:26:25 +0000 Subject: [PATCH] [#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. --- deluge/ui/gtkui/details_tab.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/deluge/ui/gtkui/details_tab.py b/deluge/ui/gtkui/details_tab.py index 83a6ce486..b823383f8 100644 --- a/deluge/ui/gtkui/details_tab.py +++ b/deluge/ui/gtkui/details_tab.py @@ -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('%s' % (txt, txt.replace('&', '&'))) + txt = cgi.escape(txt) + if widget[2][0] == "comment" and is_url(txt): + widget[0].set_markup('%s' % (txt, txt)) else: - widget[0].set_markup(txt.replace('&', '&')) + widget[0].set_markup(txt) def clear(self): for widget in self.label_widgets: