diff --git a/dangerzone/conversion/doc_to_pixels.py b/dangerzone/conversion/doc_to_pixels.py index 10e73ee..fd50f1c 100644 --- a/dangerzone/conversion/doc_to_pixels.py +++ b/dangerzone/conversion/doc_to_pixels.py @@ -78,10 +78,6 @@ class DocumentToPixels(DangerzoneConverter): "type": "libreoffice", }, # .hwp - "application/vnd.hancom.hwp": { - "type": "libreoffice", - "libreoffice_ext": "h2orestart.oxt", - }, "application/haansofthwp": { "type": "libreoffice", "libreoffice_ext": "h2orestart.oxt", @@ -91,16 +87,9 @@ class DocumentToPixels(DangerzoneConverter): "libreoffice_ext": "h2orestart.oxt", }, # .hwpx - "application/vnd.hancom.hwpx": { - "type": "libreoffice", - "libreoffice_ext": "h2orestart.oxt", - }, - "application/haansofthwpx": { - "type": "libreoffice", - "libreoffice_ext": "h2orestart.oxt", - }, "application/hwp+zip": { "type": "libreoffice", + "libreoffice_ext": "h2orestart.oxt", }, # At least .odt, .docx, .odg, .odp, .ods, and .pptx "application/zip": { @@ -136,6 +125,13 @@ class DocumentToPixels(DangerzoneConverter): if mime_type not in conversions: raise ValueError("The document format is not supported") + # Temporary fix for the HWPX format + if mime_type == "application/zip": + file_type = magic.from_file("/tmp/input_file") + hwpx_file_type = 'Zip data (MIME type "application/hwp+zip"?)' + if file_type == hwpx_file_type: + mime_type = "application/hwp+zip" + # Get file size (in MiB) size = os.path.getsize("/tmp/input_file") / 1024**2