From 3e12aa3dfd8244a9cc3a3aa49b03ae19c5972223 Mon Sep 17 00:00:00 2001 From: Alex Pyrgiotis Date: Wed, 9 Oct 2024 18:36:29 +0300 Subject: [PATCH] FIXUP: Fix progress percentages --- dangerzone/isolation_provider/base.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/dangerzone/isolation_provider/base.py b/dangerzone/isolation_provider/base.py index d585872..a855f34 100644 --- a/dangerzone/isolation_provider/base.py +++ b/dangerzone/isolation_provider/base.py @@ -183,7 +183,6 @@ class IsolationProvider(ABC): text = ( f"Converting page {page}/{n_pages} from pixels to {searchable}PDF" ) - percentage += step self.print_progress(document, False, text, percentage) width = read_int(p.stdout) @@ -199,8 +198,6 @@ class IsolationProvider(ABC): num_pixels, ) - percentage += step - page_pdf = self.pixels_to_pdf_page( untrusted_pixels, width, @@ -209,6 +206,8 @@ class IsolationProvider(ABC): ) safe_doc.insert_pdf(page_pdf) + percentage += step + # Ensure nothing else is read after all bitmaps are obtained p.stdout.close() @@ -218,8 +217,8 @@ class IsolationProvider(ABC): os.replace(document.sanitized_output_filename, document.output_filename) # TODO handle leftover code input - text = "Converted document" - self.print_progress(document, False, text, percentage) + text = "Successfully converted document" + self.print_progress(document, False, text, 100) def print_progress( self, document: Document, error: bool, text: str, percentage: float