From 82507d418eb27152f982a9fe2efeb1334aef8e5c Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 17 Oct 2021 13:33:02 +0100 Subject: [PATCH] Check that attributedTo is a string --- posts.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/posts.py b/posts.py index 988ea791d..fb706643f 100644 --- a/posts.py +++ b/posts.py @@ -5062,22 +5062,22 @@ def getOriginalPostFromAnnounceUrl(announceUrl: str, baseDir: str, return None, None, None if not isinstance(announcePostJson['object'], str): return None, None, None + actor = url = None # do we have the original post? origPostId = announcePostJson['object'] origFilename = locatePost(baseDir, nickname, domain, origPostId) - actor = url = None if origFilename: # we have the original post origPostJson = loadJson(origFilename, 0, 1) if origPostJson: - url = announcePostJson['object'] if hasObjectDict(origPostJson): if origPostJson['object'].get('attributedTo'): - actor = origPostJson['object']['attributedTo'] + if isinstance(origPostJson['object']['attributedTo'], str): + actor = origPostJson['object']['attributedTo'] + url = origPostId elif origPostJson['object'].get('actor'): actor = origPostJson['actor'] - else: - url = None + url = origPostId else: # we don't have the original post if hasUsersPath(origPostId):