From 2392ff3b530b1ded5e110920297db6cbc3e4e97b Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Wed, 28 Dec 2022 17:37:50 +0100 Subject: [PATCH] handle split char false positive --- tnc/data_handler.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tnc/data_handler.py b/tnc/data_handler.py index 2afff286..8b5eaab1 100644 --- a/tnc/data_handler.py +++ b/tnc/data_handler.py @@ -3104,7 +3104,13 @@ class DATA: os.makedirs(f"{folder_path}/{callsign_path}") split_char = b"\0;\1;" + n_objects = 8 decoded_data = data_frame.split(split_char) + # if we have a false positive in case our split_char is available in data + # lets stick the data together, so we are not loosing it + if len(decoded_data) > n_objects: + file_data = b''.join(list[n_objects:]) + decoded_data = [*decoded_data[:n_objects], file_data] if decoded_data[0] in [b'm']: checksum_delivered = str(decoded_data[2], "utf-8").lower()