Skip to content

Commit

Permalink
Make sure Person IRIs are generated correctly
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Anthony Wang committed Jun 14, 2022
1 parent d06772b commit a312007
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion routers/api/v1/activitypub/person.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package activitypub

import (
"net/http"
"strings"

"code.gitea.io/gitea/modules/activitypub"
"code.gitea.io/gitea/modules/context"
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit a312007

Please sign in to comment.