From c249abdb10cfd5f4e63518f01f6ceeac84e7ac5e Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Thu, 8 May 2025 14:05:44 -0400 Subject: [PATCH] Fix ActivityPub following from Ghost This makes Follow request parsing more robust. Previously, this only worked if the `object` was a URI, which is what many platforms send. Now, we can also handle objects here. --- activitypub.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/activitypub.go b/activitypub.go index f6f8792..e8b67d2 100644 --- a/activitypub.go +++ b/activitypub.go @@ -436,6 +436,17 @@ func handleFetchCollectionInbox(app *App, w http.ResponseWriter, r *http.Request a.AppendObject(f.Raw()) _, to = f.GetActor(0) obj := f.Raw().GetObjectIRI(0) + if obj == nil { + if debugging { + log.Error("GetObjectIRI on Follow for actor is empty; trying object") + } + ao := f.Raw().GetObject(0) + if ao == nil { + log.Error("Fell back to GetObject and none parsed, so no actor ID! Follow request probably FAILED!") + } else { + obj = ao.GetId() + } + } a.AppendActor(obj) // First get actor information