From cbdb741f7b4352ed3778123be42c7b6abaa401bc Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Tue, 23 Nov 2021 16:28:26 -0800 Subject: [PATCH] Need to keep the rename step --- dangerzone/container.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dangerzone/container.py b/dangerzone/container.py index 248f854..1144c8f 100644 --- a/dangerzone/container.py +++ b/dangerzone/container.py @@ -111,6 +111,15 @@ def convert(input_filename, output_filename, ocr_lang, stdout_callback): if ret != 0: print("pixels-to-pdf failed") else: + # Move the final file to the right place + if os.path.exists(output_filename): + os.remove(output_filename) + + container_output_filename = os.path.join( + safe_dir, "safe-output-compressed.pdf" + ) + os.rename(container_output_filename, output_filename) + # We did it success = True