From 1ff0b9d4ffc9afdc7fc6ba94035b2180bad2b42e Mon Sep 17 00:00:00 2001 From: gongzhiyong Date: Wed, 8 Apr 2026 18:39:16 +0800 Subject: [PATCH] fix(backend): delete_attachment 204 response must not declare a body Litestar validates that handlers with 204 status codes cannot return a response body. The delete_attachment handler was declared as -> Response and returned Response(content=None, status_code=204), which caused ImproperlyConfiguredException at startup and crashed all workers. Change return type to None and move status_code to the @delete decorator. Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/app/api/attachments.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/backend/app/api/attachments.py b/backend/app/api/attachments.py index 93d3be0..fc8dcd1 100644 --- a/backend/app/api/attachments.py +++ b/backend/app/api/attachments.py @@ -181,8 +181,8 @@ async def download_attachment(attachment_id: str) -> Response: ) -@delete("/api/attachments/{attachment_id:str}") -async def delete_attachment(attachment_id: str) -> Response: +@delete("/api/attachments/{attachment_id:str}", status_code=204) +async def delete_attachment(attachment_id: str) -> None: """DELETE /api/attachments/:id -- Delete attachment (blob + DB record).""" async with async_session_factory() as session: attachment = await session.get(Attachment, attachment_id) @@ -211,5 +211,3 @@ async def delete_attachment(attachment_id: str) -> Response: # Delete from database await session.delete(attachment) await session.commit() - - return Response(content=None, status_code=204)