Don't attempt to decode empty byte sequence
This commit is contained in:
parent
9b4aaa101f
commit
6834a6de95
1 changed files with 6 additions and 0 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Reference in a new issue