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

Jean-Baptiste Kempf jb at videolan.org
Mon Dec 26 16:24:11 CET 2016


Hello,

If it is an URI, then it shouldn't be using path2uri.

On Wed, 21 Dec 2016, at 20:04, Frank Praznik wrote:
> 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
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


-- 
Jean-Baptiste Kempf -  President
+33 672 704 734


More information about the vlc-devel mailing list