[vlc-commits] dsm: fix double dir separator in dir urls

Thomas Guillem git at videolan.org
Tue Jan 12 09:58:44 CET 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jan 12 09:32:28 2016 +0100| [c08eb8d3df6f1b97bc45a1fcd5244ab6b75b8300] | committer: Thomas Guillem

dsm: fix double dir separator in dir urls

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c08eb8d3df6f1b97bc45a1fcd5244ab6b75b8300
---

 modules/access/dsm/access.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/access/dsm/access.c b/modules/access/dsm/access.c
index e81d186..d97b951 100644
--- a/modules/access/dsm/access.c
+++ b/modules/access/dsm/access.c
@@ -539,8 +539,11 @@ static input_item_t *new_item( access_t *p_access, const char *psz_name,
     char *psz_encoded_name = vlc_uri_encode( psz_name );
     if( psz_encoded_name == NULL )
         return NULL;
-    i_ret = asprintf( &psz_uri, "smb://%s/%s", p_access->psz_location,
-                      psz_encoded_name );
+    const char *psz_sep = p_access->psz_location[0] != '\0'
+        && p_access->psz_location[strlen(p_access->psz_location) -1] != '/'
+        ? "/" : "";
+    i_ret = asprintf( &psz_uri, "smb://%s%s%s", p_access->psz_location,
+                      psz_sep, psz_encoded_name );
     free( psz_encoded_name );
     if( i_ret == -1 )
         return NULL;



More information about the vlc-commits mailing list