Fix bad image downloads

This commit is contained in:
Scott Wallace 2023-05-31 11:53:09 +01:00
parent cbc96b425c
commit 0c400fb4d5
Signed by: scott
GPG key ID: AA742FDC5AFE2A72
2 changed files with 6 additions and 3 deletions

View file

@ -1,6 +1,6 @@
maubot: 0.1.0 maubot: 0.1.0
id: lomion.tmdb id: lomion.tmdb
version: 1.3.0+scott-1fb64b9 version: 1.3.0+scott
license: AGPL 3.0 license: AGPL 3.0
modules: modules:
- tmdb - tmdb

View file

@ -76,8 +76,11 @@ class TmdbApiSingle(TmdbApi):
async def query_image_binary(self): async def query_image_binary(self):
if self.poster_url: if self.poster_url:
async with self.session.get(self.poster_url) as resp: try:
self.poster_binary = await resp.read() async with self.session.get(self.poster_url) as resp:
self.poster_binary = await resp.read()
except aiohttp.client_exceptions.ClientConnectorError:
self.poster_binary = None
else: else:
self.poster_binary = None self.poster_binary = None