From 0135bfb1ab49be69bc698291c2f7675e6861a035 Mon Sep 17 00:00:00 2001 From: neko Date: Tue, 28 Jan 2025 09:15:52 +0500 Subject: [PATCH] Make sure source file gets removed after conversion in unoConvertDocument --- main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main.py b/main.py index d2e5525..dab32a0 100644 --- a/main.py +++ b/main.py @@ -64,6 +64,7 @@ async def unoConvertDocument(sourceDocumentPath, sourceDocumentName): outputDocumentPath = Path(outputDir) / Path(f"{sourceDocumentName}").with_suffix('.pdf') Path(outputDir).mkdir(parents=True, exist_ok=True) # Ensure directory exists subprocess.run(args=[unoconvertPath, "--convert-to", "pdf", sourceDocumentPath, outputDocumentPath]) + subprocess.run(args=["rm", sourceDocumentPath], check=True) return outputDocumentPath async def convertDocumentOneShot(sourceDocumentPath, sourceDocumentName):