Add hwp hwpx support

hwp/hwpx has several custom MIME types

.hwp:
 - application/x-hwp
 - application/haansofthwp
 - application/vnd.hancom.hwp

.hwpx:
 - application/haansofthwpx
 - application/vnd.hancom.hwpx,
 - application/hwp+zip

Fixes #243
This commit is contained in:
Moon Sungjoon 2023-06-26 18:21:53 +09:00 committed by deeplow
parent d8cc24cebe
commit 3e895adbab
No known key found for this signature in database
GPG key ID: 577982871529A52A
5 changed files with 38 additions and 2 deletions

View file

@ -14,7 +14,8 @@ RUN apk --no-cache -U upgrade && \
poppler-data \
python3 \
py3-magic \
tesseract-ocr
tesseract-ocr \
font-noto-cjk
# Download the trained models from the latest GitHub release of Tesseract, and
# store them under /usr/share/tessdata. This is basically what distro packages

View file

@ -36,6 +36,7 @@ Dangerzone can convert these types of document into safe PDFs:
- ODF Spreadsheet (`.ods`)
- ODF Presentation (`.odp`)
- ODF Graphics (`.odg`)
- Hancom HWP (Hangul Word Processor) (`.hwp`, `.hwpx`)
- Jpeg (`.jpg`, `.jpeg`)
- GIF (`.gif`)
- PNG (`.png`)

View file

@ -77,6 +77,26 @@ class DocumentToPixels(DangerzoneConverter):
"application/vnd.oasis.opendocument.text-template": {
"type": "libreoffice",
},
# .hwp
"application/vnd.hancom.hwp": {
"type": "libreoffice",
},
"application/haansofthwp": {
"type": "libreoffice",
},
"application/x-hwp": {
"type": "libreoffice",
},
# .hwpx
"application/vnd.hancom.hwpx": {
"type": "libreoffice",
},
"application/haansofthwpx": {
"type": "libreoffice",
},
"application/hwp+zip": {
"type": "libreoffice",
},
# At least .odt, .docx, .odg, .odp, .ods, and .pptx
"application/zip": {
"type": "libreoffice",

View file

@ -553,7 +553,7 @@ class DocSelectionWidget(QtWidgets.QWidget):
self.file_dialog.setFileMode(QtWidgets.QFileDialog.ExistingFiles)
self.file_dialog.setNameFilters(
[
"Documents (*.pdf *.docx *.doc *.docm *.xlsx *.xls *.pptx *.ppt *.odt *.odg *.odp *.ods *.jpg *.jpeg *.gif *.png *.tif *.tiff)"
"Documents (*.pdf *.docx *.doc *.docm *.xlsx *.xls *.pptx *.ppt *.odt *.odg *.odp *.ods *.hwp *.hwpx *.jpg *.jpeg *.gif *.png *.tif *.tiff)"
]
)

View file

@ -143,6 +143,20 @@ if p == "Darwin":
"CFBundleTypeName": "ODF Graphics Document",
"CFBundleTypeRole": "Viewer",
},
{
"CFBundleTypeExtensions": ["hwp", "hwpx"],
"CFBundleTypeIconFile": "../macos/document.icns",
"CFBundleTypeMIMETypes": [
"application/vnd.hancom.hwp",
"application/haansofthwp",
"application/x-hwp",
"application/vnd.hancom.hwpx",
"application/haansofthwpx",
"application/hwp+zip",
],
"CFBundleTypeName": "Hancom Office Document",
"CFBundleTypeRole": "Viewer",
},
{
"CFBundleTypeExtensions": ["jpg", "jpeg"],
"CFBundleTypeIconFile": "../macos/document.icns",