go-fed / activity

ActivityStreams & ActivityPub in golang, oh my!
BSD 3-Clause "New" or "Revised" License
702 stars 111 forks source link

/pub/util.go: wrapInCreate: nil pointer dereference #131

Closed kissen closed 4 years ago

kissen commented 4 years ago

I'm currently playing around with with go-fed, in particular with the social API. Having set up an actor with pub.NewActor and a handler with pub.NewActivityStreamsHandler, I try to post the following JSON taken from the ActivityPub documentation to a users outbox.

{"@context": "https://www.w3.org/ns/activitystreams",
 "type": "Note",
 "to": ["https://chatty.example/ben/"],
 "attributedTo": "https://social.example/alyssa/",
 "content": "Say, did you finish reading that book I lent you?"}

Seems like go-fed correctly tries to wrap the Note into a Create, but doing so I get a nil dereference error in activity/pub/util.go in line 284. Full stack trace further down.

Please Describe The Expected Behavior I expect the Note to be properly wrapped in a Create without a nil reference.

cjslep commented 4 years ago

Awesome bug report! Thanks a ton for documenting all of this.

Also, if you have a fediverse account, please do reach out to me at @cj@mastodon.technology. I would love to learn more about your experience using this library. Especially as I am actively updating https://go-fed.org.

cjslep commented 4 years ago

Hi @kissen

With the latest merge, can you confirm if this issue is fixed for you?

kissen commented 4 years ago

Yes, this fixes the bug from what I can tell. Thank you!

(Unfortunately I don't really have time to work on any ActiviyPub projects this summer, but maybe I'll look into it again later. I certainly continue to be interested in it.)