From a81c5f44a2aef0a1658eb6e60a7c7ef641b6b5a8 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Mon, 26 Aug 2019 11:41:22 +0200 Subject: [PATCH] improve thirtparty header parsing --- owrx/aprs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/owrx/aprs.py b/owrx/aprs.py index 085a175..13f88eb 100644 --- a/owrx/aprs.py +++ b/owrx/aprs.py @@ -20,7 +20,7 @@ encoding = "utf-8" altitudeRegex = re.compile("(^.*)\\/A=([0-9]{6})(.*$)") # regex for parsing third-party headers -thirdpartyeRegex = re.compile("^([A-Z0-9-]+)>((([A-Z0-9-]+\\*?,)*)([A-Z0-9-]+\\*?)):(.*)$") +thirdpartyeRegex = re.compile("^([a-zA-Z0-9-]+)>((([a-zA-Z0-9-]+\\*?,)*)([a-zA-Z0-9-]+\\*?)):(.*)$") def decodeBase91(input): @@ -172,9 +172,9 @@ class AprsParser(object): if matches: logger.debug(matches) path = matches[2].split(",") - destination = next((c for c in path if c.endswith("*")), None) + destination = next((c.strip("*").upper() for c in path if c.endswith("*")), None) data = self.parseAprsData({ - "source": matches[1], + "source": matches[1].upper(), "destination": destination, "path": path, "data": matches[6].encode(encoding)