diff --git a/README.md b/README.md index fa4e6c9..fd53d4f 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,8 @@ Dangerzone can convert these types of document into safe PDFs: - ODF Graphics (`.odg`) - Hancom HWP (Hangul Word Processor) (`.hwp`, `.hwpx`) * Not supported on - [Qubes OS](https://github.com/freedomofpress/dangerzone/issues/494) + [MacOS with Apple Silicon CPU](https://github.com/freedomofpress/dangerzone/issues/498) + or [Qubes OS](https://github.com/freedomofpress/dangerzone/issues/494) - Jpeg (`.jpg`, `.jpeg`) - GIF (`.gif`) - PNG (`.png`) diff --git a/dangerzone/conversion/doc_to_pixels.py b/dangerzone/conversion/doc_to_pixels.py index 48f301d..e828dbb 100644 --- a/dangerzone/conversion/doc_to_pixels.py +++ b/dangerzone/conversion/doc_to_pixels.py @@ -10,6 +10,7 @@ Here are the steps, with progress bar percentages: import asyncio import glob import os +import platform import re import shutil import sys @@ -188,6 +189,13 @@ class DocumentToPixels(DangerzoneConverter): # # https://github.com/freedomofpress/dangerzone/issues/494 # https://github.com/freedomofpress/dangerzone/issues/498 + if libreoffice_ext == "h2orestart.oxt" and platform.machine() in ( + "arm64", + "aarch64", + ): + raise ValueError( + "HWP / HWPX formats are not supported in ARM architectures" + ) if libreoffice_ext == "h2orestart.oxt" and running_on_qubes(): raise errors.DocFormatUnsupportedHWPQubes() if libreoffice_ext: diff --git a/dangerzone/gui/main_window.py b/dangerzone/gui/main_window.py index acbf6c4..408f109 100644 --- a/dangerzone/gui/main_window.py +++ b/dangerzone/gui/main_window.py @@ -557,13 +557,15 @@ class DocSelectionWidget(QtWidgets.QWidget): self.file_dialog.setWindowTitle("Open Documents") self.file_dialog.setFileMode(QtWidgets.QFileDialog.ExistingFiles) - # XXX: We disable loading HWP/HWPX files on Qubes, because H2ORestart does not work there. - # See: + # XXX: We disable loading HWP/HWPX files on Qubes or MacOS M1 platforms, because + # H2ORestart does not work there. See: # # https://github.com/freedomofpress/dangerzone/issues/494 + # https://github.com/freedomofpress/dangerzone/issues/498 hwp_filters = "*.hwp *.hwpx" - if is_qubes_native_conversion(): + if platform.machine() in ("arm64", "aarch64") or is_qubes_native_conversion(): hwp_filters = "" + self.file_dialog.setNameFilters( [ f"Documents (*.pdf *.docx *.doc *.docm *.xlsx *.xls *.pptx *.ppt *.odt *.odg *.odp *.ods {hwp_filters} *.jpg *.jpeg *.gif *.png *.tif *.tiff)" diff --git a/tests/test_cli.py b/tests/test_cli.py index 1b4774e..148918b 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -4,6 +4,7 @@ import base64 import contextlib import copy import os +import platform import re import shutil import sys @@ -307,7 +308,7 @@ class TestCliConversion(TestCliBasic): class TestExtraFormats(TestCli): @for_each_external_doc("*hwp*") def test_hancom_office(self, doc: str) -> None: - if is_qubes_native_conversion(): + if platform.machine() in ("arm64", "aarch64") or is_qubes_native_conversion(): pytest.skip("HWP / HWPX formats are not supported on this platform") with tempfile.NamedTemporaryFile("wb", delete=False) as decoded_doc: with open(doc, "rb") as encoded_doc: