From fe92b241b2a6107286ed164a829837779b136740 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 2 Aug 2024 12:39:12 +0200 Subject: [PATCH] Fix status processing failing halfway when a remote post has a malformed `replies` attribute (#31246) --- app/lib/activitypub/activity/create.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index 1581555bd..d93497521 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -332,13 +332,15 @@ class ActivityPub::Activity::Create < ActivityPub::Activity def fetch_replies(status) collection = @object['replies'] - return if collection.nil? + return if collection.blank? replies = ActivityPub::FetchRepliesService.new.call(status, collection, allow_synchronous_requests: false, request_id: @options[:request_id]) return unless replies.nil? uri = value_or_id(collection) ActivityPub::FetchRepliesWorker.perform_async(status.id, uri, { 'request_id' => @options[:request_id] }) unless uri.nil? + rescue => e + Rails.logger.warn "Error fetching replies: #{e}" end def conversation_from_uri(uri)