From e7252a643fb90c93fed1ff9eafde1861d7a9df38 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 10 Jan 2021 09:51:30 +0000 Subject: [PATCH] Check for single webfinger --- posts.py | 4 ---- webapp_post.py | 9 +++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/posts.py b/posts.py index 988d43886..133929a9b 100644 --- a/posts.py +++ b/posts.py @@ -218,10 +218,6 @@ def getPersonBox(baseDir: str, session, wfRequest: {}, 'Accept': 'application/activity+json; profile="' + profileStr + '"' } if not wfRequest.get('errors'): - # if len(wfRequest.items()) == 1: - # for wfkey, wf in wfRequest.items(): - # wfRequest = wf - # print('wfRequest changed to ' + str(wfRequest)) personUrl = getUserUrl(wfRequest, sourceId) else: if nickname == 'dev': diff --git a/webapp_post.py b/webapp_post.py index 373383c20..f00fd702a 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -1163,6 +1163,15 @@ def individualPostAsHtml(allowDownloads: bool, postActorWf = cachedWebfingers[postActorHandle] print('postActorWf: ' + postActorHandle + ' ' + str(postActorWf)) + # check for situations where the webfinger contains a single key + # which is the handle, with the webfinger content as the item + if len(postActorWf.items()) == 1: + for wfkey, wf in postActorWf.items(): + print('Single webfinger key: ' + wfkey + ' ' + postActorHandle) + if wfkey == postActorHandle: + postActorWf = wf + print('wfRequest changed to ' + str(postActorWf)) + (inboxUrl, pubKeyId, pubKey, fromPersonId, sharedInbox, avatarUrl2, displayName) = getPersonBox(baseDir, session,