From b7c421ff80bbe049f29183a1652798a1d4ea6365 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Wed, 17 Jul 2019 09:00:46 +0200 Subject: [PATCH] Bugfix when reading cached actor --- activitypub.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/activitypub.py b/activitypub.py index 251059d..c256b70 100644 --- a/activitypub.py +++ b/activitypub.py @@ -276,7 +276,13 @@ class MicroblogPubBackend(Backend): "meta.undo": False, } ) - if actor and actor["meta"].get("actor"): + + # "type" check is here to skip old metadata for "old/buggy" followers + if ( + actor + and actor["meta"].get("actor") + and "type" in actor["meta"]["actor"] + ): return actor["meta"]["actor"] # Check if it's cached because it's a following @@ -287,7 +293,11 @@ class MicroblogPubBackend(Backend): "meta.undo": False, } ) - if actor2 and actor2["meta"].get("object"): + if ( + actor2 + and actor2["meta"].get("object") + and "type" in actor2["meta"]["object"] + ): return actor2["meta"]["object"] # Fetch the URL via HTTP