If tags are something other than a list then replace with an empty list

main2
Bob Mottram 2019-09-30 12:05:35 +01:00
parent b75faf7ac8
commit 1fa22a6777
1 changed files with 4 additions and 2 deletions

View File

@ -1134,8 +1134,10 @@ def validPostContent(messageJson: {},maxMentions: int) -> bool:
return False
# check number of tags
if messageJson['object'].get('tag'):
if isinstance(messageJson['object']['tag'], list):
if len(messageJson['object']['tag'])>maxMentions*2:
if not isinstance(messageJson['object']['tag'], list):
messageJson['object']['tag']=[]
else:
if len(messageJson['object']['tag']) > maxMentions*2:
if messageJson['object'].get('id'):
print('REJECT: '+messageJson['object']['id'])
print('REJECT: Too many tags in post - '+messageJson['object']['tag'])