From a1ca7e958af8eddc51255f41823e4ac58da6e686 Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Wed, 7 Feb 2024 14:59:39 +0100 Subject: [PATCH] use local fqdn for generated user email --- routers/api/v1/activitypub/repository.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/routers/api/v1/activitypub/repository.go b/routers/api/v1/activitypub/repository.go index 2f6fe52897..516e87ec88 100644 --- a/routers/api/v1/activitypub/repository.go +++ b/routers/api/v1/activitypub/repository.go @@ -6,6 +6,7 @@ package activitypub import ( "fmt" "net/http" + "net/url" "strings" "code.gitea.io/gitea/models/db" @@ -268,7 +269,12 @@ func createUserFromAP(ctx *context.APIContext, personID forgefed.PersonID) (*use } log.Info("RepositoryInbox: validated person: %q", person) - email := fmt.Sprintf("f%v@%v", uuid.New().String(), personID.Host) + localFqdn, err := url.ParseRequestURI(setting.AppURL) + if err != nil { + return &user_model.User{}, err + } + + email := fmt.Sprintf("f%v@%v", uuid.New().String(), localFqdn.Hostname()) loginName := personID.AsLoginName() name := fmt.Sprintf("%v%v", person.PreferredUsername.String(), personID.HostSuffix()) log.Info("RepositoryInbox: person.Name: %v", person.Name)