Skip to content

Commit 92e909f

Browse files
fix(api): allow deleting a workflow even if the thumbnail file doesn't exist
1 parent 38d556f commit 92e909f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

invokeai/app/api/routers/workflows.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
WorkflowRecordWithThumbnailDTO,
2020
WorkflowWithoutID,
2121
)
22+
from invokeai.app.services.workflow_thumbnails.workflow_thumbnails_common import WorkflowThumbnailFileNotFoundException
2223

2324
IMAGE_MAX_AGE = 31536000
2425
workflows_router = APIRouter(prefix="/v1/workflows", tags=["workflows"])
@@ -65,7 +66,11 @@ async def delete_workflow(
6566
workflow_id: str = Path(description="The workflow to delete"),
6667
) -> None:
6768
"""Deletes a workflow"""
68-
ApiDependencies.invoker.services.workflow_thumbnails.delete(workflow_id)
69+
try:
70+
ApiDependencies.invoker.services.workflow_thumbnails.delete(workflow_id)
71+
except WorkflowThumbnailFileNotFoundException:
72+
# It's OK if the workflow has no thumbnail file. We can still delete the workflow.
73+
pass
6974
ApiDependencies.invoker.services.workflow_records.delete(workflow_id)
7075

7176

0 commit comments

Comments
 (0)