[vlc-devel] [PATCH] demux/playlist/xspf: fix input-item uri creation

Filip Roséen filip at atch.se
Thu Oct 13 22:43:13 CEST 2016


The previous implementation inaccurately treated "p_sys->psz_base" as
if it was referring to whatever directory (uri-wise) that contains the
playlist we are currently processing.

Given that this is not the case, it would not handle relative paths
correctly.

These changes make sure that we use ProcessMRL to properly handle the
paths found within the playlist (the function handles both absolute
and relative ones).

fixes #17506
---
 modules/demux/playlist/xspf.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/modules/demux/playlist/xspf.c b/modules/demux/playlist/xspf.c
index 5dfbfe4..16ee1b3 100644
--- a/modules/demux/playlist/xspf.c
+++ b/modules/demux/playlist/xspf.c
@@ -484,24 +484,19 @@ static bool parse_track_node COMPLEX_INTERFACE
             if (psz_value == NULL)
                 input_item_SetURI(p_new_input, "vlc://nop");
             else
-            /* FIXME (#4005): This is broken. Scheme-relative (//...) locations
-             * and anchors (#...) are not resolved correctly. Also,
-             * host-relative (/...) and directory-relative locations
-             * ("relative path" in vernacular) should be resolved.
-             * -- Courmisch */
-            if (p_sys->psz_base && !strstr(psz_value, "://"))
             {
-                char* psz_tmp;
-                if (asprintf(&psz_tmp, "%s%s", p_sys->psz_base, psz_value)
-                    == -1)
+                char* psz_uri = ProcessMRL( psz_value, p_sys->psz_base );
+
+                if( !psz_uri )
                 {
+                    msg_Warn( p_demux, "unable to process MRL: %s", psz_value );
                     goto end;
                 }
-                input_item_SetURI(p_new_input, psz_tmp);
-                free(psz_tmp);
+
+                input_item_SetURI(p_new_input, psz_uri);
+                free(psz_uri);
             }
-            else
-                input_item_SetURI(p_new_input, psz_value);
+
             input_item_CopyOptions(p_new_input, p_input_item);
         }
         else
-- 
2.10.0



More information about the vlc-devel mailing list