gsturi: Fixed incorrect escaping of path as a generic string
authorSebastian Dröge <sebastian@centricular.com>
Thu, 15 Jun 2017 08:40:51 +0000 (11:40 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 15 Jun 2017 08:40:51 +0000 (11:40 +0300)
The gst_uri_construct function was escaping the location string
as a generic uri string. This is incorrect since the slash('/')
characters are reserved for use in this exact case. The patch
changes the escape_string function mode to handle the path correctly.

In 1.14 this function will be deprecated.

https://bugzilla.gnome.org/show_bug.cgi?id=783787

gst/gsturi.c

index 3312e33..cf4cda3 100644 (file)
@@ -249,21 +249,6 @@ escape_string_internal (const gchar * string, UnsafeCharacterSet mask)
   return result;
 }
 
-/* escape_string:
- * @string: string to be escaped
- *
- * Escapes @string, replacing any and all special characters
- * with equivalent escape sequences.
- *
- * Return value: a newly allocated string equivalent to @string
- * but with all special characters escaped
- **/
-static gchar *
-escape_string (const gchar * string)
-{
-  return escape_string_internal (string, UNSAFE_ALL);
-}
-
 static int
 hex_to_int (gchar c)
 {
@@ -522,7 +507,7 @@ gst_uri_construct (const gchar * protocol, const gchar * location)
   g_return_val_if_fail (location != NULL, NULL);
 
   proto_lowercase = g_ascii_strdown (protocol, -1);
-  escaped = escape_string (location);
+  escaped = escape_string_internal (location, UNSAFE_PATH);
   retval = g_strdup_printf ("%s://%s", proto_lowercase, escaped);
   g_free (escaped);
   g_free (proto_lowercase);