forked from mirrors/bookwyrm
Merge pull request #1109 from bookwyrm-social/invalid-image-url
Handle all kinds of invalid image urls
This commit is contained in:
commit
2a451e83c6
1 changed files with 4 additions and 1 deletions
|
@ -319,7 +319,10 @@ def upload_cover(request, book_id):
|
||||||
|
|
||||||
def set_cover_from_url(url):
|
def set_cover_from_url(url):
|
||||||
"""load it from a 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:
|
if not image_file:
|
||||||
return None
|
return None
|
||||||
image_name = str(uuid4()) + "." + url.split(".")[-1]
|
image_name = str(uuid4()) + "." + url.split(".")[-1]
|
||||||
|
|
Loading…
Reference in a new issue