diff options
author | Anthony Wang | 2023-03-15 20:14:00 +0000 |
---|---|---|
committer | Anthony Wang | 2023-03-15 20:14:00 +0000 |
commit | 3b547c695eb78908d8b01d46944604c07b41dbd1 (patch) | |
tree | ce7b738dffb64dff1c7c4c4f235f41f93c76c64d | |
parent | dbc3eb7fa071307e623fde961bfdff0894856948 (diff) |
Fix some annoying segfaults
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | go.sum | 4 | ||||
-rw-r--r-- | routers/api/v1/activitypub/create.go | 9 |
3 files changed, 10 insertions, 5 deletions
@@ -35,7 +35,7 @@ require ( github.com/felixge/fgprof v0.9.3 github.com/fsnotify/fsnotify v1.6.0 github.com/gliderlabs/ssh v0.3.5 - github.com/go-ap/activitypub v0.0.0-20230218112952-bfb607b04799 + github.com/go-ap/activitypub v0.0.0-20230307141717-3566110d71a0 github.com/go-ap/jsonld v0.0.0-20221030091449-f2a191312c73 github.com/go-chi/chi/v5 v5.0.8 github.com/go-chi/cors v1.2.1 @@ -352,8 +352,8 @@ github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4= github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= -github.com/go-ap/activitypub v0.0.0-20230218112952-bfb607b04799 h1:zVZaYt1h4yWL7uRHvq2StewCu4ObtS+ws9gGgoZJ+2s= -github.com/go-ap/activitypub v0.0.0-20230218112952-bfb607b04799/go.mod h1:1oVD0h0aPT3OEE1ZoSUoym/UGKzxe+e0y8K2AkQ1Hqs= +github.com/go-ap/activitypub v0.0.0-20230307141717-3566110d71a0 h1:ll+jcwBW55vQDUV3jHuua/0wqjTm2GIh/iP1wwjbPSc= +github.com/go-ap/activitypub v0.0.0-20230307141717-3566110d71a0/go.mod h1:1oVD0h0aPT3OEE1ZoSUoym/UGKzxe+e0y8K2AkQ1Hqs= github.com/go-ap/errors v0.0.0-20221205040414-01c1adfc98ea h1:ywGtLGVjJjMrq4mu35Qmu+NtlhlTk/gTayE6Bb4tQZk= github.com/go-ap/errors v0.0.0-20221205040414-01c1adfc98ea/go.mod h1:SaTNjEEkp0q+w3pUS1ccyEL/lUrHteORlDq/e21mCc8= github.com/go-ap/jsonld v0.0.0-20221030091449-f2a191312c73 h1:GMKIYXyXPGIp+hYiWOhfqK4A023HdgisDT4YGgf99mw= diff --git a/routers/api/v1/activitypub/create.go b/routers/api/v1/activitypub/create.go index 591671c0c..4b0ba5edf 100644 --- a/routers/api/v1/activitypub/create.go +++ b/routers/api/v1/activitypub/create.go @@ -119,7 +119,7 @@ func createPersonFromIRI(ctx context.Context, personIRI ap.IRI) error { if err != nil { return err } - return ap.On(object, func(p *ap.Person) error { + return ap.OnActor(object, func(p *ap.Person) error { return createPerson(ctx, p) }) } @@ -128,16 +128,21 @@ func createPersonFromIRI(ctx context.Context, personIRI ap.IRI) error { func createRepository(ctx context.Context, repository *forgefed.Repository) error { user, err := user_model.GetUserByIRI(ctx, repository.AttributedTo.GetLink().String()) if user_model.IsErrUserNotExist(err) { + // TODO: This should probably return the created user too err := createPersonFromIRI(ctx, repository.AttributedTo.GetLink()) if err != nil { return err } + user, err = user_model.GetUserByIRI(ctx, repository.AttributedTo.GetLink().String()) + if err != nil { + return err + } } else if err != nil { return err } // Check if repo exists - _, err = repo_model.GetRepositoryByOwnerAndName(ctx, user.Name, repository.Name.String()) + _, err = repo_model.GetRepositoryByIRI(ctx, repository.GetLink().String()) if !repo_model.IsErrRepoNotExist(err) { return err } |