fix: close library upload flow and harden image storage
This commit is contained in:
@@ -155,7 +155,9 @@ def install_ai_images(app, service):
|
||||
image_data = base64.b64decode(result[0]["b64_json"], validate=True)
|
||||
else:
|
||||
image_data = service.assets.fetch_url(result[0]["url"])
|
||||
with Image.open(BytesIO(image_data)) as image:
|
||||
with Image.open(
|
||||
BytesIO(image_data), formats=("JPEG", "PNG", "WEBP")
|
||||
) as image:
|
||||
if image.width * image.height > MAX_IMAGE_PIXELS:
|
||||
raise ValueError()
|
||||
rgba = ImageOps.exif_transpose(image).convert("RGBA")
|
||||
|
||||
Reference in New Issue
Block a user