[meld] Fix unescaped file paths in some error messages



commit c20fc10bc4036d882f6a7734d1ad3f72a5ca047d
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Fri Aug 31 06:45:30 2012 +1000

    Fix unescaped file paths in some error messages
    
    File paths need to be escaped for MsgArea display because Pango markup
    is used. This patch adds escaping for some of the more obvious places
    where this may occur.

 meld/filediff.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 40f724d..4643c67 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -948,9 +948,10 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
                     nextbit = t.file.read(4096)
                     if nextbit.find("\x00") != -1:
                         t.buf.delete(*t.buf.get_bounds())
+                        filename = gobject.markup_escape_text(t.filename)
                         add_dismissable_msg(t.pane, gtk.STOCK_DIALOG_ERROR,
                             _("Could not read file"),
-                            _("%s appears to be a binary file.") % t.filename)
+                            _("%s appears to be a binary file.") % filename)
                         tasks.remove(t)
                         continue
                 except ValueError as err:
@@ -960,10 +961,11 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
                         t.file = codecs.open(t.filename, "rU", t.codec[0])
                     else:
                         t.buf.delete(*t.buf.get_bounds())
+                        filename = gobject.markup_escape_text(t.filename)
                         add_dismissable_msg(t.pane, gtk.STOCK_DIALOG_ERROR,
                                         _("Could not read file"),
                                         _("%s is not in encodings: %s") %
-                                            (t.filename, try_codecs))
+                                            (filename, try_codecs))
                         tasks.remove(t)
                 except IOError as ioerr:
                     add_dismissable_msg(t.pane, gtk.STOCK_DIALOG_ERROR,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]