mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-29 05:06:11 +01:00
Catch edge case: remote user does not exist on remote repo
This commit is contained in:
parent
0378b2dc7d
commit
071b47b8d0
|
@ -120,7 +120,7 @@ func RepositoryInbox(ctx *context.APIContext) {
|
||||||
{
|
{
|
||||||
user, err = createUserFromAP(ctx, actorId)
|
user, err = createUserFromAP(ctx, actorId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("Searching for user failed", err)
|
ctx.ServerError("Creating user failed", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Info("RepositoryInbox: created user from ap: %v", user)
|
log.Info("RepositoryInbox: created user from ap: %v", user)
|
||||||
|
@ -195,7 +195,11 @@ func createUserFromAP(ctx *context.APIContext, personId forgefed.PersonId) (*use
|
||||||
}
|
}
|
||||||
log.Info("RepositoryInbox: got body: %v", string(body))
|
log.Info("RepositoryInbox: got body: %v", string(body))
|
||||||
person := ap.Person{}
|
person := ap.Person{}
|
||||||
err = person.UnmarshalJSON(body)
|
if strings.Contains(string(body), "user does not exist") {
|
||||||
|
err = fmt.Errorf("the requested user id did not exist on the remote server: %v", personId.Id)
|
||||||
|
} else {
|
||||||
|
err = person.UnmarshalJSON(body)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &user_model.User{}, err
|
return &user_model.User{}, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue