diff --git a/db/repositories/documents/documents.py b/db/repositories/documents/documents.py index 42ae8ac..aa25648 100644 --- a/db/repositories/documents/documents.py +++ b/db/repositories/documents/documents.py @@ -210,7 +210,7 @@ async def preview(self, document: Dict[str, Any]) -> FileResponse: raise ValueError("Unsupported file type.") # Creating a temp file - with tempfile.NamedTemporaryFile(delete=False, suffix=extension) as temp: + with tempfile.NamedTemporaryFile(delete=True, suffix=extension) as temp: temp.write(file) temp_path = temp.name