]> git.sesse.net Git - vlc/commitdiff
FTP: fix relative file paths (fix #3984)
authorRémi Denis-Courmont <remi@remlab.net>
Mon, 2 Aug 2010 18:42:22 +0000 (21:42 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Mon, 2 Aug 2010 18:43:25 +0000 (21:43 +0300)
modules/access/ftp.c

index ca50e0cc1dff9cb0c8b3df45977e876c31af16bb..127ee3572971f1f086605768513d501751019da1 100644 (file)
@@ -303,11 +303,16 @@ static int parseURL( vlc_url_t *url, const char *path )
     if( url->i_port <= 0 )
         url->i_port = IPPORT_FTP; /* default port */
 
+    if( url->psz_path == NULL )
+        return VLC_SUCCESS;
     /* FTP URLs are relative to user's default directory (RFC1738 §3.2)
     For absolute path use ftp://foo.bar//usr/local/etc/filename */
     /* FIXME: we should issue a series of CWD, one per slash */
-    if( url->psz_path == NULL )
-        return VLC_SUCCESS;
+    if( url->psz_path )
+    {
+        assert( url->psz_path[0] == '/' );
+        url->psz_path++;
+    }
 
     char *type = strstr( url->psz_path, ";type=" );
     if( type )