Skip to content

Commit

Permalink
fix logging of decompressed messages
Browse files Browse the repository at this point in the history
they may show up as memoryviews and need converting to utf8 via bytes
  • Loading branch information
totaam committed Oct 18, 2022
1 parent 82294c8 commit 9005980
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions xpra/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,16 @@ def net_utf8(value):
"""
Given a value received by the network layer,
convert it to a string.
Gymnastics are involved if the rencode packet encoder is used
as it ends up giving us a string which is actually utf8 bytes.
Gymnastics are involved if:
- we get a memoryview from lz4
- the rencode packet encoder is used
as it ends up giving us a string which is actually utf8 bytes.
"""
#with 'rencodeplus' or 'bencode', we just get the unicode string directly:
if isinstance(value, str):
return value
if isinstance(value, memoryview):
value = value.tobytes()
#with rencode v1, we have to decode the value:
#(after converting it to 'bytes' if necessary)
return u(strtobytes(value))
Expand Down

0 comments on commit 9005980

Please sign in to comment.