From 1761c24bed529028bb14c2a828875af46058442e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 27 Oct 2021 16:10:18 +0100 Subject: [PATCH] Check that tags have a type --- posts.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/posts.py b/posts.py index ee09d8991..587d805e2 100644 --- a/posts.py +++ b/posts.py @@ -596,6 +596,8 @@ def _getPosts(session, outboxUrl: str, maxPosts: int, if isinstance(thisItem, dict): if thisItem.get('tag'): for tagItem in thisItem['tag']: + if not tagItem.get('type'): + continue tagType = tagItem['type'].lower() if tagType == 'emoji': if tagItem.get('name') and tagItem.get('icon'): @@ -787,6 +789,8 @@ def getPostDomains(session, outboxUrl: str, maxPosts: int, if item['object'].get('tag'): for tagItem in item['object']['tag']: + if not tagItem.get('type'): + continue tagType = tagItem['type'].lower() if tagType == 'mention': if tagItem.get('href'): @@ -855,6 +859,8 @@ def _getPostsForBlockedDomains(baseDir: str, if item['object'].get('tag'): for tagItem in item['object']['tag']: + if not tagItem.get('type'): + continue tagType = tagItem['type'].lower() if tagType == 'mention': if tagItem.get('href'):