Added extra checking to fetchart plugin.

Will avoid a KeyError being raised when Content-Type header is missing.
See #664.
This commit is contained in:
Lee Reinhardt 2014-04-06 14:42:51 -05:00
parent 9c00e43b30
commit bf05135e5f

View file

@ -47,7 +47,8 @@ def _fetch_image(url):
log.debug(u'fetchart: downloading art: {0}'.format(url))
try:
with closing(requests_session.get(url, stream=True)) as resp:
if not resp.headers['Content-Type'] in CONTENT_TYPES:
if not 'Content-Type' in resp.headers \
or not resp.headers['Content-Type'] in CONTENT_TYPES:
log.debug(u'fetchart: not an image')
return