From f1d4f092f20f31f9da230e05411932502dbc53f2 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 20 May 2021 16:03:14 -0700 Subject: [PATCH] Handle all kinds of invalid image urls --- bookwyrm/views/books.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bookwyrm/views/books.py b/bookwyrm/views/books.py index fee22e89..ef3a6e28 100644 --- a/bookwyrm/views/books.py +++ b/bookwyrm/views/books.py @@ -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]