From 5fb05f3e2fb01464badc6bdcc2c2f67aa0330c17 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Sun, 17 Mar 2024 02:21:16 +1300 Subject: [PATCH] only process post image if post url not banned --- app/activitypub/util.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/activitypub/util.py b/app/activitypub/util.py index cbdc2334..74605b4f 100644 --- a/app/activitypub/util.py +++ b/app/activitypub/util.py @@ -1284,11 +1284,11 @@ def create_post(activity_log: ActivityPubLog, community: Community, request_json if not domain.banned: domain.post_count += 1 post.domain = domain - if 'image' in request_json['object'] and post.image is None: - image = File(source_url=request_json['object']['image']['url']) - db.session.add(image) - post.image = image if post is not None: + if 'image' in request_json['object'] and post.image is None: + image = File(source_url=request_json['object']['image']['url']) + db.session.add(image) + post.image = image db.session.add(post) post.ranking = post_ranking(post.score, post.posted_at) community.post_count += 1