diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | plugins/elements/gstfilesink.c | 19 | ||||
-rw-r--r-- | plugins/elements/gstfilesrc.c | 19 |
3 files changed, 46 insertions, 2 deletions
@@ -1,3 +1,13 @@ +2007-02-02 Sebastian Dröge <slomo@circular-chaos.org> + + reviewed by: Wim Taymans <wim@fluendo.com> + + * plugins/elements/gstfilesink.c: (gst_file_sink_uri_set_uri): + * plugins/elements/gstfilesrc.c: (gst_file_src_uri_set_uri): + Allow file://localhost/foo/bar URLs and correctly fail for every other + hostname that one sets. This was gnomevfssrc is linked for those if + installed as it can handle it (#403172) + 2007-02-01 Sebastian Dröge <slomo@circular-chaos.org> reviewed by: Tim-Philipp Müller <tim at centricular dot net> diff --git a/plugins/elements/gstfilesink.c b/plugins/elements/gstfilesink.c index 25b854cad2..762121c148 100644 --- a/plugins/elements/gstfilesink.c +++ b/plugins/elements/gstfilesink.c @@ -542,7 +542,24 @@ gst_file_sink_uri_set_uri (GstURIHandler * handler, const gchar * uri) return FALSE; } g_free (protocol); - location = gst_uri_get_location (uri); + + /* allow file://localhost/foo/bar by stripping localhost but fail + * for every other hostname */ + if (g_str_has_prefix (uri, "file://localhost/")) { + char *tmp; + + /* 16 == strlen ("file://localhost") */ + tmp = g_strconcat ("file://", uri + 16, NULL); + /* we use gst_uri_get_location() although we already have the + * "location" with uri + 16 because it provides unescaping */ + location = gst_uri_get_location (tmp); + g_free (tmp); + } else if (!g_str_has_prefix (uri, "file:///")) { + return FALSE; + } else { + location = gst_uri_get_location (uri); + } + ret = gst_file_sink_set_location (sink, location); g_free (location); diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index f734d74edd..32f0f1e560 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -1062,7 +1062,24 @@ gst_file_src_uri_set_uri (GstURIHandler * handler, const gchar * uri) return FALSE; } g_free (protocol); - location = gst_uri_get_location (uri); + + /* allow file://localhost/foo/bar by stripping localhost but fail + * for every other hostname */ + if (g_str_has_prefix (uri, "file://localhost/")) { + char *tmp; + + /* 16 == strlen ("file://localhost") */ + tmp = g_strconcat ("file://", uri + 16, NULL); + /* we use gst_uri_get_location() although we already have the + * "location" with uri + 16 because it provides unescaping */ + location = gst_uri_get_location (tmp); + g_free (tmp); + } else if (!g_str_has_prefix (uri, "file:///")) { + return FALSE; + } else { + location = gst_uri_get_location (uri); + } + ret = gst_file_src_set_location (src, location); g_free (location); |