Don't attempt to decode empty byte sequence

This commit is contained in:
XANTRONIX Development 2024-11-11 02:05:05 -05:00
parent 9b4aaa101f
commit 6834a6de95

View file

@ -11,11 +11,17 @@ def decode(text: str):
decoded = decode_header(text)[0]
if decoded[1] is None:
if decoded[0] == b'':
return ''
return str(decoded[0])
try:
return str(decoded[0], decoded[1])
except:
if decoded[0] == b'':
return ''
return str(decoded[0])
def each_line(text: str):