[glade/wjt/escape-parser-errors] GladeProject: escape markup in parser errors
- From: Will Thompson <wjt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade/wjt/escape-parser-errors] GladeProject: escape markup in parser errors
- Date: Tue, 18 Sep 2018 13:33:32 +0000 (UTC)
commit 18373b590ffd4cfa265677be058e77f4e3915d46
Author: Will Thompson <will willthompson co uk>
Date: Tue Sep 18 14:30:18 2018 +0100
GladeProject: escape markup in parser errors
If you try to load a non-XML file, such as Glade's own README, the
parser error contains something like this:
Start tag expected, '<' not found
glade_util_ui_message() treats the supplied message as markup; so the
literal < in the error message trips it up:
Gtk-WARNING **: Failed to set text 'Error parsing file '/home/wjt/src/gnome/glade/README' on line 1
Start tag expected, '<' not found
' from markup due to error parsing markup: Error on line 2 char 30: Odd character 'f', expected a '='
after attribute name 'not' of element '''
To fix this, escape the message before passing it to
glade_util_ui_message().
gladeui/glade-project.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c
index 1c40c865..6367342a 100644
--- a/gladeui/glade-project.c
+++ b/gladeui/glade-project.c
@@ -2027,7 +2027,9 @@ glade_project_load_internal (GladeProject *project)
if (message)
{
- glade_util_ui_message (glade_app_get_window (), GLADE_UI_ERROR, NULL, "%s", message);
+ gchar *escaped = g_markup_escape_text (message, -1);
+ glade_util_ui_message (glade_app_get_window (), GLADE_UI_ERROR, NULL, "%s", escaped);
+ g_free (escaped);
g_free (message);
}
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]