properly handle youtube url
previously this case would fail: http://myserver.com/?dst=www.youtube.com&x=y we must check ".youtube.com" is before the query start (?). SVN revision: 77645
This commit is contained in:
parent
c5fcea8bbe
commit
52af5639d7
|
@ -1022,15 +1022,26 @@ int
|
|||
media_src_type_get(const char *src)
|
||||
{
|
||||
int type = TYPE_UNKNOWN;
|
||||
|
||||
|
||||
if (_is_fmt(src, extn_img)) type = TYPE_IMG;
|
||||
else if (_is_fmt(src, extn_scale)) type = TYPE_SCALE;
|
||||
else if (_is_fmt(src, extn_edj)) type = TYPE_EDJE;
|
||||
else if (_is_fmt(src, extn_mov)) type = TYPE_MOV;
|
||||
// handle youtube direct url's
|
||||
else if ((!strncasecmp(src, "http://", 7)) &&
|
||||
(strstr(src, ".youtube.com/")) &&
|
||||
(strchr(src, '=')) &&
|
||||
(strchr(src, '&'))) type = TYPE_MOV;
|
||||
else if (!strncasecmp(src, "http://", sizeof("http://") - 1))
|
||||
{
|
||||
const char *query;
|
||||
|
||||
src += sizeof("http://") - 1;
|
||||
query = strchr(src, '?');
|
||||
if (query)
|
||||
{
|
||||
if (strchr(query + 1, '=') && strchr(query + 1, '&'))
|
||||
{
|
||||
const char *p = strstr(src, ".youtube.com/");
|
||||
if (p && (p < query))
|
||||
type = TYPE_MOV;
|
||||
}
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue