Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update e2e.py #71

Merged
merged 1 commit into from
Feb 11, 2025
Merged

Update e2e.py #71

merged 1 commit into from
Feb 11, 2025

Conversation

bruderjakob12
Copy link
Contributor

Preventing UnicodeDecodeError in case that Umlaute, etc. are in e.g., an images description.

Original error-message read:

Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/threema/gateway/e2e.py", line 1300, in unpack
content = bytes(reader.readexactly(len(reader))).decode('ascii')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 259: ordinal not in range(128)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/python-docker/app.py", line 125, in handle_callback
message = await e2e.Message.receive(connection, {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/threema/gateway/e2e.py", line 506, in receive
return await class_.unpack(connection, parameters, key_pair, reader)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/threema/gateway/e2e.py", line 1302, in unpack
raise MessageError('Could not decode JSON') from exc
threema.gateway.exception.MessageError: Could not decode JSON

Preventing UnicodeDecodeError in case that Umlaute, etc. are in e.g., an images description.
@threema-lenny
Copy link
Collaborator

Oof, nice catch.

@threema-lenny threema-lenny merged commit 19ba796 into threema-ch:master Feb 11, 2025
1 check passed
@threema-lenny
Copy link
Collaborator

This got lost in my backlog for some reason. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants