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.
This commit is contained in:
Matt Baer 2025-05-08 14:05:44 -04:00
parent db66a885fb
commit c249abdb10

View file

@ -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