diff options
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2012-01-13 12:19:31 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2012-01-13 12:32:21 +0000 |
commit | 3fe47d77f1a167effe92096f7d6b6e099ea707dd (patch) | |
tree | 4884a6f62b224ab89cf058f8ae56615c6b128eb8 | |
parent | 49e185c5720b747e84dd2d36d24a2a2efec14d19 (diff) |
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).
-rw-r--r-- | 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: |