check UTF-8 for COLORCODE

This commit is contained in:
Waldek 2021-03-29 19:39:12 +02:00 committed by GitHub
parent 12d453874b
commit 040a5cd991
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -266,7 +266,11 @@ def add_hb_peer(_peer_conf, _ctable_loc, _peer):
else:
_ctable_peer['CALLSIGN'] = _peer_conf['CALLSIGN']
_ctable_peer['COLORCODE'] = _peer_conf['COLORCODE'].decode('utf-8')
if str(type(_peer_conf['COLORCODE'])).find("bytes") != -1:
_ctable_peer['COLORCODE'] = _peer_conf['COLORCODE'].decode('utf-8').strip()
else:
_ctable_peer['COLORCODE'] = _peer_conf['COLORCODE']
_ctable_peer['CONNECTION'] = _peer_conf['CONNECTION']
_ctable_peer['CONNECTED'] = since(_peer_conf['CONNECTED'])
_ctable_peer['IP'] = _peer_conf['IP']