From 13a16bec1853a95e9189d6e0832d41bb6bb61acb Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 17 Oct 2019 15:41:47 +0100 Subject: [PATCH] Handle errors returned from webfinger --- epicyon.py | 4 ++++ posts.py | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/epicyon.py b/epicyon.py index 3919c19e7..16992d6d4 100644 --- a/epicyon.py +++ b/epicyon.py @@ -883,6 +883,10 @@ if args.actor: print('Unable to webfinger '+nickname+'@'+domain) sys.exit() + if wfRequest.get('errors'): + print('wfRequest error: '+str(wfRequest['errors'])) + sys.exit() + asHeader = {'Accept': 'application/activity+json; profile="https://www.w3.org/ns/activitystreams"'} personUrl = getUserUrl(wfRequest) if nickname==domain: diff --git a/posts.py b/posts.py index ea4c7216e..ffdee4f8e 100644 --- a/posts.py +++ b/posts.py @@ -1343,6 +1343,11 @@ def sendSignedJson(postJsonObject: {},session,baseDir: str, \ print('DEBUG: webfinger for '+handle+' failed') return 1 + if wfRequest.get('errors'): + if debug: + print('DEBUG: webfinger for '+handle+' failed with errors '+str(wfRequest)) + return 1 + if not clientToServer: postToBox='inbox' else: @@ -1596,7 +1601,8 @@ def hasSharedInbox(session,httpPrefix: str,domain: str) -> bool: wfRequest=webfingerHandle(session,domain+'@'+domain,httpPrefix,{}, \ None,__version__) if wfRequest: - return True + if not wfRequest.get('errors'): + return True return False def sendToFollowers(session,baseDir: str, \