From dcf76f996e3158f2140111004615ce0cb6433416 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 2 Aug 2021 21:43:53 +0100 Subject: [PATCH] Handle actors with no public post feed --- posts.py | 13 ++++++++++--- session.py | 3 ++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/posts.py b/posts.py index 247f2b073..fe68d6b58 100644 --- a/posts.py +++ b/posts.py @@ -397,9 +397,12 @@ def _getPosts(session, outboxUrl: str, maxPosts: int, if debug: print('Returning a human readable version of the feed') - i = 0 userFeed = parseUserFeed(session, outboxUrl, asHeader, projectVersion, httpPrefix, domain, debug) + if not userFeed: + return personPosts + + i = 0 for item in userFeed: if not item.get('id'): if debug: @@ -3673,12 +3676,16 @@ def getPublicPostsOfPerson(baseDir: str, nickname: str, domain: str, personCache = {} cachedWebfingers = {} federationList = [] - + groupAccount = False + if nickname.startswith('!'): + nickname = nickname[1:] + groupAccount = True domainFull = getFullDomain(domain, port) handle = httpPrefix + "://" + domainFull + "/@" + nickname + wfRequest = \ webfingerHandle(session, handle, httpPrefix, cachedWebfingers, - domain, projectVersion, debug, False) + domain, projectVersion, debug, groupAccount) if not wfRequest: if debug: print('No webfinger result was returned for ' + handle) diff --git a/session.py b/session.py index b1f0b8d89..f0e60db0b 100644 --- a/session.py +++ b/session.py @@ -124,7 +124,8 @@ def getJson(session, url: str, headers: {}, params: {}, debug: bool, else: print('WARN: getJson url: ' + url + ' failed with error code ' + - str(result.status_code)) + str(result.status_code) + + ' headers: ' + str(sessionHeaders)) return result.json() except requests.exceptions.RequestException as e: sessionHeaders2 = sessionHeaders.copy()