summaryrefslogtreecommitdiff
path: root/gtk/tools
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2018-11-27 12:13:31 -0600
committerFederico Mena Quintero <federico@gnome.org>2018-11-27 13:57:21 -0600
commite5f9bf2e9b85764ec22926be3532ef1b53ed8408 (patch)
tree8c13a2f3983c83a4bd29f465692eb96c3cae3c81 /gtk/tools
parent0be4d3121716180ef1bed2eda89bd81c3a5e760e (diff)
downloadgtk+-e5f9bf2e9b85764ec22926be3532ef1b53ed8408.tar.gz
(#1471): base64-encode included SVGs to avoid mis-escaped characters
We wrap SVG data from icons within another SVG with extra styling information. The wrapped SVG may contain characters that cannot be part of a data: URL (https://fetch.spec.whatwg.org/#data-urls). Librsvg 2.45 got more strict in its parsing of data: URLs; whereas previously it ignored '#' characters in them, now it considers them to be the start of a fragment identifier, which is not allowed in data: URLs anyway. To avoid unallowed characters, we now create a data: URL with a base-64 encoded SVG. Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1471
Diffstat (limited to 'gtk/tools')
-rw-r--r--gtk/tools/gdkpixbufutils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gtk/tools/gdkpixbufutils.c b/gtk/tools/gdkpixbufutils.c
index b47ebf9df8..0ed23bd3dc 100644
--- a/gtk/tools/gdkpixbufutils.c
+++ b/gtk/tools/gdkpixbufutils.c
@@ -178,7 +178,7 @@ load_symbolic_svg (const char *file_data,
svg_height = g_strdup_printf ("%d", gdk_pixbuf_get_height (pixbuf));
g_object_unref (pixbuf);
- escaped_file_data = g_markup_escape_text (file_data, file_len);
+ escaped_file_data = g_base64_encode ((guchar *) file_data, file_len);
data = g_strconcat ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
"<svg version=\"1.1\"\n"
@@ -200,7 +200,7 @@ load_symbolic_svg (const char *file_data,
" fill: ", css_success, " !important;\n"
" }\n"
" </style>\n"
- " <xi:include href=\"data:text/xml,", escaped_file_data, "\"/>\n"
+ " <xi:include href=\"data:text/xml;base64,", escaped_file_data, "\"/>\n"
"</svg>",
NULL);
g_free (escaped_file_data);