ssb address validation

main
Bob Mottram 2020-02-26 14:51:37 +00:00
parent a9958736bb
commit 48e757c765
1 changed files with 8 additions and 4 deletions

12
ssb.py
View File

@ -31,6 +31,10 @@ def getSSBAddress(actorJson: {}) -> str:
continue continue
if '"' in propertyValue['value']: if '"' in propertyValue['value']:
continue continue
if ' ' in propertyValue['value']:
continue
if ',' in propertyValue['value']:
continue
return propertyValue['value'] return propertyValue['value']
return '' return ''
@ -54,15 +58,15 @@ def setSSBAddress(actorJson: {},ssbAddress: str) -> None:
if propertyFound: if propertyFound:
actorJson['attachment'].remove(propertyFound) actorJson['attachment'].remove(propertyFound)
if '@' not in ssbAddress:
return
if not ssbAddress.startswith('@'): if not ssbAddress.startswith('@'):
return return
if '.' not in ssbAddress: if '=.' not in ssbAddress:
return return
if '"' in ssbAddress: if '"' in ssbAddress:
return return
if ':' not in ssbAddress: if ' ' in ssbAddress:
return
if ',' in ssbAddress:
return return
for propertyValue in actorJson['attachment']: for propertyValue in actorJson['attachment']: