MediaThumbnail.download: Raise error if thumbnail has no valid mime type

master
Felix Stupp 1 year ago
parent 518e0fd675
commit e6fa101c1d
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -611,7 +611,7 @@ class MediaThumbnail(db.Entity):
res = requests.get(url=self.uri, headers=THUMBNAIL_HEADERS)
mime = magic.from_buffer(res.content, mime=True)
if mime not in THUMBNAIL_ALLOWED_TYPES:
return False
raise Exception(f"Couldn't download thumbnail: {thumbnail.uri}")
self.mime_type = mime
self.data = res.content
self.last_downloaded = datetime.now()

Loading…
Cancel
Save