From 4e720aa6e21681c272ae8116606a105c90a55580 Mon Sep 17 00:00:00 2001 From: deeplow Date: Mon, 29 Jan 2024 16:36:16 +0000 Subject: [PATCH] Replace 'None' conversion type with "PyMuPDF" Replaced for clarity over the fact that this conversion is in fact handled by PyMuPDF. --- dangerzone/conversion/doc_to_pixels.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dangerzone/conversion/doc_to_pixels.py b/dangerzone/conversion/doc_to_pixels.py index 6ac2dd0..38e437a 100644 --- a/dangerzone/conversion/doc_to_pixels.py +++ b/dangerzone/conversion/doc_to_pixels.py @@ -47,7 +47,7 @@ class DocumentToPixels(DangerzoneConverter): async def convert(self) -> None: conversions: Dict[str, Dict[str, Optional[str]]] = { # .pdf - "application/pdf": {"type": None}, + "application/pdf": {"type": "PyMuPDF"}, # .docx "application/vnd.openxmlformats-officedocument.wordprocessingml.document": { "type": "libreoffice", @@ -146,14 +146,14 @@ class DocumentToPixels(DangerzoneConverter): "type": "libreoffice", }, # .jpg - "image/jpeg": {"type": None}, + "image/jpeg": {"type": "PyMuPDF"}, # .gif - "image/gif": {"type": None}, + "image/gif": {"type": "PyMuPDF"}, # .png - "image/png": {"type": None}, + "image/png": {"type": "PyMuPDF"}, # .tif - "image/tiff": {"type": None}, - "image/x-tiff": {"type": None}, + "image/tiff": {"type": "PyMuPDF"}, + "image/x-tiff": {"type": "PyMuPDF"}, } # Detect MIME type @@ -173,7 +173,7 @@ class DocumentToPixels(DangerzoneConverter): # Convert input document to PDF conversion = conversions[mime_type] - if conversion["type"] is None: + if conversion["type"] == "PyMuPDF": try: doc = fitz.open("/tmp/input_file", filetype=mime_type) except (ValueError, fitz.FileDataError):