mirror of
https://github.com/meshtastic/python.git
synced 2026-04-20 06:47:44 -04:00
fix unrelated bug when fromStr input is short hex
For example, 0x0 will generate an unhandled ValueError. This was caught during a random unit test run for 3.9, so I figure I'd fix it. This is unrelated to the PR otherwise.
This commit is contained in:
@@ -82,7 +82,7 @@ def fromStr(valstr):
|
||||
val = bytes()
|
||||
elif valstr.startswith("0x"):
|
||||
# if needed convert to string with asBytes.decode('utf-8')
|
||||
val = bytes.fromhex(valstr[2:])
|
||||
val = bytes.fromhex(valstr[2:].zfill(2))
|
||||
elif valstr.startswith("base64:"):
|
||||
val = base64.b64decode(valstr[7:])
|
||||
elif valstr.lower() in {"t", "true", "yes"}:
|
||||
|
||||
Reference in New Issue
Block a user