guard against content-type http header not being present

This commit is contained in:
Ed Summers
2021-09-18 20:44:07 +00:00
parent fd292f6222
commit be69e525b9
2 changed files with 2 additions and 2 deletions

View File

@ -167,7 +167,7 @@ def collect_images(entry, generator=None):
for url in urls:
try:
resp = http.request('GET', url, preload_content=False)
if resp.headers['content-type'].startswith(("image/", "video/")):
if resp.headers.get('content-type', '').startswith(("image/", "video/")):
images.append(resp)
# IMPORTANT: Need to release_conn() later!
if len(images) >= MAX_IMAGES:

View File

@ -5,7 +5,7 @@ with open("README.md") as f:
setup(
name='feediverse',
version='0.2.0',
version='0.2.1',
python_requires='>=3.3',
url='https://github.com/edsu/feediverse',
author='Ed Summers',