From 2c295919e63eb35fa607a46e0b4e9dc49b619cfb Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 14 Dec 2021 14:35:51 +0000 Subject: [PATCH] Include attachments text within filter scan of profile bio --- person.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/person.py b/person.py index b31f916b3..181e2ea8d 100644 --- a/person.py +++ b/person.py @@ -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 ' +