forked from indymedia/epicyon
Remove ssb address if invalid
parent
bacc38eff2
commit
1a347ac878
23
ssb.py
23
ssb.py
|
@ -41,6 +41,18 @@ def getSSBAddress(actorJson: {}) -> str:
|
||||||
def setSSBAddress(actorJson: {}, ssbAddress: str) -> None:
|
def setSSBAddress(actorJson: {}, ssbAddress: str) -> None:
|
||||||
"""Sets an ssb address for the given actor
|
"""Sets an ssb address for the given actor
|
||||||
"""
|
"""
|
||||||
|
notSSBAddress = False
|
||||||
|
if not ssbAddress.startswith('@'):
|
||||||
|
notSSBAddress = True
|
||||||
|
if '=.' not in ssbAddress:
|
||||||
|
notSSBAddress = True
|
||||||
|
if '"' in ssbAddress:
|
||||||
|
notSSBAddress = True
|
||||||
|
if ' ' in ssbAddress:
|
||||||
|
notSSBAddress = True
|
||||||
|
if ',' in ssbAddress:
|
||||||
|
notSSBAddress = True
|
||||||
|
|
||||||
if not actorJson.get('attachment'):
|
if not actorJson.get('attachment'):
|
||||||
actorJson['attachment'] = []
|
actorJson['attachment'] = []
|
||||||
|
|
||||||
|
@ -57,16 +69,7 @@ def setSSBAddress(actorJson: {}, ssbAddress: str) -> None:
|
||||||
break
|
break
|
||||||
if propertyFound:
|
if propertyFound:
|
||||||
actorJson['attachment'].remove(propertyFound)
|
actorJson['attachment'].remove(propertyFound)
|
||||||
|
if notSSBAddress:
|
||||||
if not ssbAddress.startswith('@'):
|
|
||||||
return
|
|
||||||
if '=.' not in ssbAddress:
|
|
||||||
return
|
|
||||||
if '"' in ssbAddress:
|
|
||||||
return
|
|
||||||
if ' ' in ssbAddress:
|
|
||||||
return
|
|
||||||
if ',' in ssbAddress:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
for propertyValue in actorJson['attachment']:
|
for propertyValue in actorJson['attachment']:
|
||||||
|
|
Loading…
Reference in New Issue