Include attachments text within filter scan of profile bio

main
Bob Mottram 2021-12-14 14:35:51 +00:00
parent 533c07d502
commit 2c295919e6
1 changed files with 15 additions and 6 deletions

View File

@ -1686,6 +1686,21 @@ def validSendingActor(session, baseDir: str,
return False
bioStr = removeHtml(actorJson['summary'])
bioStr += ' ' + removeHtml(actorJson['preferredUsername'])
if actorJson.get('attachment'):
if isinstance(actorJson['attachment'], list):
for tag in actorJson['attachment']:
if not isinstance(tag, dict):
continue
if not tag.get('name'):
continue
if isinstance(tag['name'], str):
bioStr += ' ' + tag['name']
if tag.get('value'):
continue
if isinstance(tag['value'], str):
bioStr += ' ' + tag['value']
if actorJson.get('name'):
bioStr += ' ' + removeHtml(actorJson['name'])
if containsInvalidChars(bioStr):
@ -1721,12 +1736,6 @@ def validSendingActor(session, baseDir: str,
if len(tag['value']) < 2:
tagsWithoutValue += 1
continue
if containsInvalidChars(tag['name']):
tagsWithoutValue += 1
continue
if containsInvalidChars(tag['value']):
tagsWithoutValue += 1
continue
if noOfTags > 0:
if int(tagsWithoutValue * 100 / noOfTags) > 50:
print('REJECT: actor has empty attachments ' +