diff --git a/foxnouns/tasks.py b/foxnouns/tasks.py index 4fe5170..e6af598 100644 --- a/foxnouns/tasks.py +++ b/foxnouns/tasks.py @@ -29,8 +29,9 @@ def convert_avatar(uri: str) -> bytes: if not uri.startswith("data:image/"): raise ValueError("Not a data URI") - content_type, encoded = uri.removeprefix("data:").split("base64,", 1) - logger.info(f"{content_type=}") + content_type, encoded = uri.removeprefix("data:").split(";base64,", 1) + if content_type not in ["image/png", "image/webp", "image/jpeg"]: + raise ValueError("Invalid content type for image") img = pyvips.Image.thumbnail_buffer( base64.b64decode(encoded),