From 1dc062b1d81c6af2688d9e7afdda3d751ac49979 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 1 Aug 2023 09:54:24 +0100 Subject: [PATCH] Check that returned json is a dict --- webapp_post.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/webapp_post.py b/webapp_post.py index 623312668..cbf5cf984 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -1543,19 +1543,20 @@ def _get_post_title_reply_html(base_dir: str, headers, None, debug, __version__, http_prefix, domain) if reply_post_json: - obj_json = reply_post_json - if has_object_dict(reply_post_json): - obj_json = reply_post_json['object'] - if obj_json.get('attributedTo'): - if isinstance(obj_json['attributedTo'], str): - reply_actor = obj_json['attributedTo'] - in_reply_to = reply_actor - elif obj_json != reply_post_json: + if isinstance(reply_post_json, dict): obj_json = reply_post_json + if has_object_dict(reply_post_json): + obj_json = reply_post_json['object'] if obj_json.get('attributedTo'): if isinstance(obj_json['attributedTo'], str): reply_actor = obj_json['attributedTo'] in_reply_to = reply_actor + elif obj_json != reply_post_json: + obj_json = reply_post_json + if obj_json.get('attributedTo'): + if isinstance(obj_json['attributedTo'], str): + reply_actor = obj_json['attributedTo'] + in_reply_to = reply_actor if post_domain and not reply_actor: title_str += \