1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-04 08:17:24 -05:00

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.
This commit is contained in:
Anthony Wang 2022-06-14 12:30:36 -05:00
parent d06772b376
commit a3120079a5
No known key found for this signature in database
GPG Key ID: BC96B00AEC5F2D76

View File

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