Don't retrieve ICY StreamUrls without jpg/png extension (don't want to risk initiating a major, useless download)

This commit is contained in:
ejurgensen 2015-06-20 23:11:18 +02:00
parent 227017ef5b
commit b6703ab7cd
1 changed files with 7 additions and 0 deletions

View File

@ -684,6 +684,7 @@ artwork_get_player_image(struct evbuffer *evbuf, char *path)
struct keyval *kv; struct keyval *kv;
const char *content_type; const char *content_type;
char *url; char *url;
char *ext;
int format; int format;
int id; int id;
int len; int len;
@ -704,6 +705,12 @@ artwork_get_player_image(struct evbuffer *evbuf, char *path)
if ((len < 14) || (len > PATH_MAX)) // Can't be shorter than http://a/1.jpg if ((len < 14) || (len > PATH_MAX)) // Can't be shorter than http://a/1.jpg
goto out_url; goto out_url;
ext = strrchr(url, '.');
if (!ext)
goto out_url;
if ((strcmp(ext, ".jpg") != 0) && (strcmp(ext, ".png") != 0))
goto out_url;
cache_artwork_read(evbuf, url, &format); cache_artwork_read(evbuf, url, &format);
if (format > 0) if (format > 0)
goto out_url; goto out_url;