[vlc-commits] lua_http: fix name parsing on encoded uri
Francois Cartegnie
git at videolan.org
Sun Sep 25 00:15:38 CEST 2011
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Sep 25 00:02:43 2011 +0200| [d0031ad29ccc52fb08e0257b0f4a76d34144d56c] | committer: Francois Cartegnie
lua_http: fix name parsing on encoded uri
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d0031ad29ccc52fb08e0257b0f4a76d34144d56c
---
modules/lua/vlc.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/modules/lua/vlc.c b/modules/lua/vlc.c
index fd90076..fd8a511 100644
--- a/modules/lua/vlc.c
+++ b/modules/lua/vlc.c
@@ -500,6 +500,7 @@ int vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L,
if( lua_isstring( L, -1 ) )
{
const char *psz_path = NULL;
+ char *psz_u8path = NULL;
const char *psz_name = NULL;
char **ppsz_options = NULL;
int i_options = 0;
@@ -520,7 +521,15 @@ int vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L,
{
if( !lua_isnil( L, -1 ) )
msg_Warn( p_this, "Playlist item name should be a string." );
- psz_name = psz_path;
+
+ psz_u8path = make_path( psz_path );
+ if ( psz_u8path )
+ {
+ psz_name = strrchr( psz_u8path, '/' );
+ if ( psz_name != NULL )
+ psz_name++;
+ }
+ if ( !psz_name ) psz_name = psz_path;
}
/* Read duration */
@@ -574,6 +583,7 @@ int vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L,
while( i_options > 0 )
free( ppsz_options[--i_options] );
free( ppsz_options );
+ free( psz_u8path );
}
else
{
More information about the vlc-commits
mailing list