diff --git a/litecord/blueprints/channel/messages.py b/litecord/blueprints/channel/messages.py index a6f5196..53d92af 100644 --- a/litecord/blueprints/channel/messages.py +++ b/litecord/blueprints/channel/messages.py @@ -272,6 +272,9 @@ async def process_url_embed(config, storage, dispatcher, session, payload: dict) img_proxy_url = proxify(url, config=config) meta = await fetch_metadata(url, config=config, session=session) + if meta is None: + continue + if not meta['image']: continue diff --git a/litecord/embed/sanitizer.py b/litecord/embed/sanitizer.py index 9a59894..6126eda 100644 --- a/litecord/embed/sanitizer.py +++ b/litecord/embed/sanitizer.py @@ -119,6 +119,10 @@ async def fetch_metadata(url, *, config=None, session=None) -> dict: async with session.get(request_url) as resp: if resp.status != 200: + body = await resp.text() + + log.warning('failed to generate meta for {!r}: {} {!r}', + url, resp.status, body) return return await resp.json() diff --git a/litecord/schemas.py b/litecord/schemas.py index a6a6bcf..20a9f19 100644 --- a/litecord/schemas.py +++ b/litecord/schemas.py @@ -179,7 +179,8 @@ REGISTER = { 'invite': {'type': 'string', 'required': False, 'nullable': True}, # optional 'fingerprint': {'type': 'string', 'required': False, 'nullable': True}, # these are sent by official client 'captcha_key': {'type': 'string', 'required': False, 'nullable': True}, - 'consent': {'type': 'boolean'} + 'consent': {'type': 'boolean'}, + 'gift_code_sku_id': {'type': 'string', 'required': False, 'nullable': True} } # only used by us, not discord, hence 'invcode' (to separate from discord)