Skip to content

Commit b9f01e2

Browse files
committed
enforce opensky serial format
fixes: #369
1 parent 4709f7d commit b9f01e2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/modules/adsb-feeder/filesystem/root/opt/adsb/adsb-setup/utils/other_aggregators.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,17 @@ def _request_fr_serial(self, user: str) -> Optional[str]:
481481
flash("OpenSky: couldn't find a serial number in server response")
482482
return None
483483

484-
return serial_match.group(1)
484+
serial = serial_match.group(1)
485+
# new opensky serial numbers all start with a dash and are purely decimal numbers
486+
# apparently somehow (i'd guess their server but who knows) users are getting base64 serial
487+
# numbers which don't work
488+
# enforce format to avoid issues
489+
if not re.match("-[0-9]*", serial):
490+
print_err(f"serial number in container output is invalid: {output}")
491+
flash("OpenSky: got an invalid serial number, please try again or report this error")
492+
return None
493+
494+
return serial
485495

486496
def _activate(self, user_input: str, idx: int = 0) -> bool:
487497
self._idx = make_int(idx)

0 commit comments

Comments
 (0)