slight logic rework

This commit is contained in:
Michael Gillett
2025-01-26 12:55:03 -05:00
parent b522abf33e
commit d0023df8ca

View File

@@ -470,9 +470,13 @@ class MeshInterface: # pylint: disable=R0902
"""
# issue 464: allow for 0x prefix in destinationId for hex values
if type(destinationId) == str:
destinationId = destinationId.replace('0x', '!')
logging.debug(f'destinationId: {destinationId}')
# destination ids can either be integers or strings with a !prefix
try:
int(destinationId)
except ValueError:
# only take the last 8 characters of the destinationId and force a ! prefix
destinationId = f'!{destinationId[-8:]}'
logging.info(f"Formatted destinationId: {destinationId}")
if getattr(data, "SerializeToString", None):
logging.debug(f"Serializing protobuf as data: {stripnl(data)}")