From a3120079a5dd4376c7c85584bdc5f6290cf5b84e Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Tue, 14 Jun 2022 12:30:36 -0500 Subject: [PATCH] Make sure Person IRIs are generated correctly This commit ensures that if the setting.AppURL is something like "http://127.0.0.1:42567" (like in the integration tests), a trailing slash will be added after that URL. --- routers/api/v1/activitypub/person.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/routers/api/v1/activitypub/person.go b/routers/api/v1/activitypub/person.go index 663493312f..f5c24ce917 100644 --- a/routers/api/v1/activitypub/person.go +++ b/routers/api/v1/activitypub/person.go @@ -6,6 +6,7 @@ package activitypub import ( "net/http" + "strings" "code.gitea.io/gitea/modules/activitypub" "code.gitea.io/gitea/modules/context" @@ -33,7 +34,7 @@ func Person(ctx *context.APIContext) { // "200": // "$ref": "#/responses/ActivityPub" - link := setting.AppURL + "api/v1/activitypub/user/" + ctx.ContextUser.Name + link := strings.TrimSuffix(setting.AppURL, "/") + "/api/v1/activitypub/user/" + ctx.ContextUser.Name person := ap.PersonNew(ap.IRI(link)) person.Name = ap.NaturalLanguageValuesNew()