Merge pull request #1109 from bookwyrm-social/invalid-image-url

Handle all kinds of invalid image urls
This commit is contained in:
Mouse Reeve
2021-05-20 16:18:44 -07:00
committed by GitHub

View File

@ -319,7 +319,10 @@ def upload_cover(request, book_id):
def set_cover_from_url(url):
"""load it from a url"""
image_file = get_image(url)
try:
image_file = get_image(url)
except: # pylint: disable=bare-except
return None
if not image_file:
return None
image_name = str(uuid4()) + "." + url.split(".")[-1]