From 6834a6de95129b91f63478d9adaba6a36af4e0b6 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Mon, 11 Nov 2024 02:05:05 -0500 Subject: [PATCH] Don't attempt to decode empty byte sequence --- lib/nntp/tiny/message.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/nntp/tiny/message.py b/lib/nntp/tiny/message.py index 64ea003..c0f9673 100644 --- a/lib/nntp/tiny/message.py +++ b/lib/nntp/tiny/message.py @@ -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):