From dd6752f5ffd23785d57965541b0a4331abcb752e Mon Sep 17 00:00:00 2001 From: jiisanda Date: Sun, 10 Dec 2023 18:22:26 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=80=20preview=20auto-delete=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/repositories/documents/documents.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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