summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2025-02-03 12:52:24 +0100
committerLibravatar GitHub <noreply@github.com>2025-02-03 11:52:24 +0000
commit053d820845e776b605598f138954bd0d8314736b (patch)
tree5d8ac550bd5da06eb5afaa48b6496e3313d96f57
parent[chore]: Bump github.com/minio/minio-go/v7 from 7.0.81 to 7.0.84 (#3728) (diff)
downloadgotosocial-053d820845e776b605598f138954bd0d8314736b.tar.xz
[bugfix] Don't panic on delivery of Activity with no `object` (#3730)
-rw-r--r--internal/federation/federatingprotocol.go45
1 files changed, 24 insertions, 21 deletions
diff --git a/internal/federation/federatingprotocol.go b/internal/federation/federatingprotocol.go
index 2bf934161..e577acefd 100644
--- a/internal/federation/federatingprotocol.go
+++ b/internal/federation/federatingprotocol.go
@@ -116,33 +116,36 @@ func (f *Federator) PostInboxRequestBodyHook(ctx context.Context, r *http.Reques
otherIRIs = append(otherIRIs, ap.ExtractCcURIs(addressable)...)
}
- // Now perform the same checks, but for the Object(s) of the Activity.
+ // Now perform the same checks, but
+ // for any Object(s) of the Activity.
objectProp := activity.GetActivityStreamsObject()
- for iter := objectProp.Begin(); iter != objectProp.End(); iter = iter.Next() {
- if iter.IsIRI() {
- otherIRIs = append(otherIRIs, iter.GetIRI())
- continue
- }
+ if objectProp != nil {
+ for iter := objectProp.Begin(); iter != objectProp.End(); iter = iter.Next() {
+ if iter.IsIRI() {
+ otherIRIs = append(otherIRIs, iter.GetIRI())
+ continue
+ }
- t := iter.GetType()
- if t == nil {
- continue
- }
+ t := iter.GetType()
+ if t == nil {
+ continue
+ }
- objectID, err := pub.GetId(t)
- if err == nil {
- otherIRIs = append(otherIRIs, objectID)
- }
+ objectID, err := pub.GetId(t)
+ if err == nil {
+ otherIRIs = append(otherIRIs, objectID)
+ }
- if replyToable, ok := t.(ap.ReplyToable); ok {
- if inReplyToURI := ap.ExtractInReplyToURI(replyToable); inReplyToURI != nil {
- otherIRIs = append(otherIRIs, inReplyToURI)
+ if replyToable, ok := t.(ap.ReplyToable); ok {
+ if inReplyToURI := ap.ExtractInReplyToURI(replyToable); inReplyToURI != nil {
+ otherIRIs = append(otherIRIs, inReplyToURI)
+ }
}
- }
- if addressable, ok := t.(ap.Addressable); ok {
- otherIRIs = append(otherIRIs, ap.ExtractToURIs(addressable)...)
- otherIRIs = append(otherIRIs, ap.ExtractCcURIs(addressable)...)
+ if addressable, ok := t.(ap.Addressable); ok {
+ otherIRIs = append(otherIRIs, ap.ExtractToURIs(addressable)...)
+ otherIRIs = append(otherIRIs, ap.ExtractCcURIs(addressable)...)
+ }
}
}