[vlc-devel] [PATCH 2/2] Don't mangle URIs when passed into vlc_path2uri().

Frank Praznik frank.praznik at gmail.com
Wed Dec 21 20:04:03 CET 2016


If a valid URI is passed into vlc_path2uri() it will be mangled by having the
working directory prepended to it. Check if the passed path is already a URI
and return an untouched copy if it is.

Signed-off-by: Frank Praznik <frank.praznik at gmail.com>
---

 This is needed to fix the loading of remote subtitles in particular as paths
 such as smb://remoteserver/video/subtitles.srt were being mangled into
 /home/user/smb://remoteserver/video/subtitles.srt since the function prepends
 the working directory to any path which doesn't begin with a path separator.

 src/text/url.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/text/url.c b/src/text/url.c
index 4430dba..219ad66 100644
--- a/src/text/url.c
+++ b/src/text/url.c
@@ -148,6 +148,10 @@ char *vlc_path2uri (const char *path, const char *scheme)
     /* Note: VLC cannot handle URI schemes without double slash after the
      * scheme name (such as mailto: or news:). */
 
+    /* Don't mangle existing URIs if one is passed in */
+    if (strstr(path, "://"))
+        return strdup(path);
+
     char *buf;
 
 #ifdef __OS2__
-- 
2.9.3



More information about the vlc-devel mailing list