Skip to content

Commit a312007

Browse files
author
Anthony Wang
committed
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.
1 parent d06772b commit a312007

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

routers/api/v1/activitypub/person.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package activitypub
66

77
import (
88
"net/http"
9+
"strings"
910

1011
"code.gitea.io/gitea/modules/activitypub"
1112
"code.gitea.io/gitea/modules/context"
@@ -33,7 +34,7 @@ func Person(ctx *context.APIContext) {
3334
// "200":
3435
// "$ref": "#/responses/ActivityPub"
3536

36-
link := setting.AppURL + "api/v1/activitypub/user/" + ctx.ContextUser.Name
37+
link := strings.TrimSuffix(setting.AppURL, "/") + "/api/v1/activitypub/user/" + ctx.ContextUser.Name
3738
person := ap.PersonNew(ap.IRI(link))
3839

3940
person.Name = ap.NaturalLanguageValuesNew()

0 commit comments

Comments
 (0)