mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(db): handle PIL errors opening images gracefully
For example, if PIL tries to open a *really* big image, it will raise an exception to prevent reading a huge object into memory.
This commit is contained in:
parent
aefa828237
commit
b6ed4ba559
@ -159,6 +159,9 @@ class Migration2Callback:
|
|||||||
except ImageFileNotFoundException:
|
except ImageFileNotFoundException:
|
||||||
self._logger.warning(f"Image {image_name} not found, skipping")
|
self._logger.warning(f"Image {image_name} not found, skipping")
|
||||||
continue
|
continue
|
||||||
|
except Exception as e:
|
||||||
|
self._logger.warning(f"Error while checking image {image_name}, skipping: {e}")
|
||||||
|
continue
|
||||||
if "invokeai_workflow" in pil_image.info:
|
if "invokeai_workflow" in pil_image.info:
|
||||||
try:
|
try:
|
||||||
UnsafeWorkflowWithVersionValidator.validate_json(pil_image.info.get("invokeai_workflow", ""))
|
UnsafeWorkflowWithVersionValidator.validate_json(pil_image.info.get("invokeai_workflow", ""))
|
||||||
|
Loading…
Reference in New Issue
Block a user