Update dependency extract-msg to >= 0.32.0
When setting up a new mayan edms instance using the default docker-compose and env file from
curl https://gitlab.com/mayan-edms/mayan-edms/-/raw/master/docker/docker-compose.yml -O
curl https://gitlab.com/mayan-edms/mayan-edms/-/raw/master/docker/.env -O
uploading msg-files fails in most cases with
app_1 | [2022-06-15 12:30:54,404: CRITICAL/ForkPoolWorker-6] Unexpected exception while trying to create new document "000001569531.msg"; Encoding property not found
app_1 | [2022-06-15 12:30:54,408: ERROR/ForkPoolWorker-6] Task mayan.apps.documents.tasks.task_document_upload[f2bc0924-126a-493e-8e87-519fd114ad12] raised unexpected: MissingEncodingError('Encoding property not found')
app_1 | Traceback (most recent call last):
app_1 | File "/opt/mayan-edms/lib/python3.9/site-packages/extract_msg/message_base.py", line 261, in header
app_1 | return self._header
app_1 | AttributeError: 'Message' object has no attribute '_header'
app_1 |
app_1 | During handling of the above exception, another exception occurred:
app_1 |
app_1 | Traceback (most recent call last):
app_1 | File "/opt/mayan-edms/lib/python3.9/site-packages/extract_msg/msg.py", line 491, in stringEncoding
app_1 | return self.__stringEncoding
app_1 | AttributeError: 'Message' object has no attribute '_MSGFile__stringEncoding'
app_1 |
app_1 | During handling of the above exception, another exception occurred:
app_1 |
app_1 | Traceback (most recent call last):
app_1 | [..]
app_1 | File "/opt/mayan-edms/lib/python3.9/site-packages/extract_msg/msg.py", line 501, in stringEncoding
app_1 | raise MissingEncodingError('Encoding property not found')
app_1 | extract_msg.exceptions.MissingEncodingError: Encoding property not found
I observed the most reliable failures with msg files that contain attachements in jgp format generated by a scanner.
This seems to be fixed in a newer msg-extractor versions. From their changelog
[..]
# v0.32.0
[..]
- Actually removed the exception I meant to remove in 0.31.0.
[..]
# v0.31.0
[..]
- Finally found the behavior to use for missing encoding. As such, MissingEncodingError is being removed from the module entirely, as it is no longer a thing.
[..]
To verify that newer versions solve this problem, I updated the extract-msg version inside the docker container (and ignored the the error that the version is incompatible with mayan edms
docker-compose exec app bash
root@c3b19ddb65c3:/# source opt/mayan-edms/bin/activate
(mayan-edms) root@c3b19ddb65c3:/# pip install extract-msg==0.34.2
[..]
mayan-edms 4.2.5 requires extract-msg==0.28.7, but you have extract-msg 0.34.2 which is incompatible.
[..]
After restarting mayan edms, I could successfully import all tested msg files.