ssb address validation

merge-requests/6/head
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
if '"' in propertyValue['value']:
continue
if ' ' in propertyValue['value']:
continue
if ',' in propertyValue['value']:
continue
return propertyValue['value']
return ''
@ -54,15 +58,15 @@ def setSSBAddress(actorJson: {},ssbAddress: str) -> None:
if propertyFound:
actorJson['attachment'].remove(propertyFound)
if '@' not in ssbAddress:
return
if not ssbAddress.startswith('@'):
return
if '.' not in ssbAddress:
if '=.' not in ssbAddress:
return
if '"' in ssbAddress:
return
if ':' not in ssbAddress:
if ' ' in ssbAddress:
return
if ',' in ssbAddress:
return
for propertyValue in actorJson['attachment']: