gnonlin: gnlfilesource: unescape URIs when converting an URI into a filename

Tim Müller tpm at kemper.freedesktop.org
Fri Jan 13 04:33:21 PST 2012


Module: gnonlin
Branch: master
Commit: 3fe47d77f1a167effe92096f7d6b6e099ea707dd
URL:    http://cgit.freedesktop.org/gstreamer/gnonlin/commit/?id=3fe47d77f1a167effe92096f7d6b6e099ea707dd

Author: Tim-Philipp Müller <tim.muller at collabora.co.uk>
Date:   Fri Jan 13 12:19:31 2012 +0000

gnlfilesource: unescape URIs when converting an URI into a filename

URIs may contain escapes, which need to be unescaped when creating
a filename (even if we pass an URI that's unescaped, we may get back
an escaped one, can't really make any assumptions).

---

 gnl/gnlfilesource.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/gnl/gnlfilesource.c b/gnl/gnlfilesource.c
index 688a1a5..82d789b 100644
--- a/gnl/gnlfilesource.c
+++ b/gnl/gnlfilesource.c
@@ -146,10 +146,12 @@ gnl_filesource_get_property (GObject * object, guint prop_id,
       const gchar *uri = NULL;;
 
       g_object_get (fs, "uri", &uri, NULL);
-      if (uri != NULL && g_str_has_prefix (uri, "file://"))
-        g_value_set_string (value, uri + 7);
-      else
+      if (uri != NULL && g_str_has_prefix (uri, "file://")) {
+        /* URIs may contain escaped characters, need to unescape those */
+        g_value_take_string (value, g_filename_from_uri (uri, NULL, NULL));
+      } else {
         g_value_set_string (value, NULL);
+      }
     }
       break;
     default:



More information about the gstreamer-commits mailing list