mirror of https://gitlab.com/bashrc2/epicyon
Remove tox address if invalid
parent
c34aa81962
commit
bacc38eff2
28
tox.py
28
tox.py
|
@ -43,6 +43,21 @@ def getToxAddress(actorJson: {}) -> str:
|
||||||
def setToxAddress(actorJson: {}, toxAddress: str) -> None:
|
def setToxAddress(actorJson: {}, toxAddress: str) -> None:
|
||||||
"""Sets an tox address for the given actor
|
"""Sets an tox address for the given actor
|
||||||
"""
|
"""
|
||||||
|
notToxAddress = False
|
||||||
|
|
||||||
|
if len(toxAddress) != 76:
|
||||||
|
notToxAddress = True
|
||||||
|
if toxAddress.upper() != toxAddress:
|
||||||
|
notToxAddress = True
|
||||||
|
if '"' in toxAddress:
|
||||||
|
notToxAddress = True
|
||||||
|
if ' ' in toxAddress:
|
||||||
|
notToxAddress = True
|
||||||
|
if '.' in toxAddress:
|
||||||
|
notToxAddress = True
|
||||||
|
if ',' in toxAddress:
|
||||||
|
notToxAddress = True
|
||||||
|
|
||||||
if not actorJson.get('attachment'):
|
if not actorJson.get('attachment'):
|
||||||
actorJson['attachment'] = []
|
actorJson['attachment'] = []
|
||||||
|
|
||||||
|
@ -59,18 +74,7 @@ def setToxAddress(actorJson: {}, toxAddress: str) -> None:
|
||||||
break
|
break
|
||||||
if propertyFound:
|
if propertyFound:
|
||||||
actorJson['attachment'].remove(propertyFound)
|
actorJson['attachment'].remove(propertyFound)
|
||||||
|
if notToxAddress:
|
||||||
if len(toxAddress) != 76:
|
|
||||||
return
|
|
||||||
if toxAddress.upper() != toxAddress:
|
|
||||||
return
|
|
||||||
if '"' in toxAddress:
|
|
||||||
return
|
|
||||||
if ' ' in toxAddress:
|
|
||||||
return
|
|
||||||
if '.' in toxAddress:
|
|
||||||
return
|
|
||||||
if ',' in toxAddress:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
for propertyValue in actorJson['attachment']:
|
for propertyValue in actorJson['attachment']:
|
||||||
|
|
Loading…
Reference in New Issue