[vlc-devel] [PATCH 1/2] playlist/preparser: do not "download" local art

Filip Roséen filip at atch.se
Thu Dec 8 11:14:19 CET 2016


The previous implementation would consider FILE:///art.jpg to be a
remote resources, meaning that it would try to "download" the file and
put it in the cache.

Given that the scheme part of an URI is case-insensitive (as stated in
RFC3986 3.1.), these changes make sure that we treat the affected
schemes in the way which was intended.

fixes #17759
---
 src/playlist/fetcher.c   | 2 +-
 src/playlist/preparser.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/playlist/fetcher.c b/src/playlist/fetcher.c
index 25d84d1..1fdb64c 100644
--- a/src/playlist/fetcher.c
+++ b/src/playlist/fetcher.c
@@ -363,7 +363,7 @@ static int DownloadArt( playlist_fetcher_t *p_fetcher, input_item_t *p_item )
     char *psz_arturl = input_item_GetArtURL( p_item );
     assert( *psz_arturl );
 
-    if( !strncmp( psz_arturl , "file://", 7 ) )
+    if( !strncasecmp( psz_arturl , "file://", 7 ) )
     {
         msg_Dbg( p_fetcher->object,
                  "Album art is local file, no need to cache" );
diff --git a/src/playlist/preparser.c b/src/playlist/preparser.c
index 9abae9f..c56918b 100644
--- a/src/playlist/preparser.c
+++ b/src/playlist/preparser.c
@@ -309,8 +309,8 @@ static void Art( playlist_preparser_t *p_preparser, input_item_t *p_item )
         const char *psz_arturl = vlc_meta_Get( p_item->p_meta, vlc_meta_ArtworkURL );
         const char *psz_name = vlc_meta_Get( p_item->p_meta, vlc_meta_Title );
 
-        if( !psz_arturl || ( strncmp( psz_arturl, "file://", 7 ) &&
-                             strncmp( psz_arturl, "attachment://", 13 ) ) )
+        if( !psz_arturl || ( strncasecmp( psz_arturl, "file://", 7 ) &&
+                             strncasecmp( psz_arturl, "attachment://", 13 ) ) )
         {
             msg_Dbg( obj, "meta ok for %s, need to fetch art",
                      psz_name ? psz_name : "(null)" );
-- 
2.10.2



More information about the vlc-devel mailing list