mirror of
https://github.com/writefreely/writefreely
synced 2024-11-30 12:29:10 +00:00
fix: do second actor deref from main-key endpoint against publickey.Owner
This commit is contained in:
parent
427f4980b9
commit
69eb4d6b0a
1 changed files with 17 additions and 2 deletions
|
@ -822,13 +822,28 @@ func getActor(app *App, actorIRI string) (*activitystreams.Person, *RemoteUser,
|
||||||
log.Info("Not found; fetching actor %s remotely", actorIRI)
|
log.Info("Not found; fetching actor %s remotely", actorIRI)
|
||||||
actorResp, err := resolveIRI(app.cfg.App.Host, actorIRI)
|
actorResp, err := resolveIRI(app.cfg.App.Host, actorIRI)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Unable to get actor! %v", err)
|
log.Error("Unable to get base actor! %v", err)
|
||||||
return nil, nil, impart.HTTPError{http.StatusInternalServerError, "Couldn't fetch actor."}
|
return nil, nil, impart.HTTPError{http.StatusInternalServerError, "Couldn't fetch actor."}
|
||||||
}
|
}
|
||||||
if err := unmarshalActor(actorResp, actor); err != nil {
|
if err := unmarshalActor(actorResp, actor); err != nil {
|
||||||
log.Error("Unable to unmarshal actor! %v", err)
|
log.Error("Unable to unmarshal base actor! %v", err)
|
||||||
return nil, nil, impart.HTTPError{http.StatusInternalServerError, "Couldn't parse actor."}
|
return nil, nil, impart.HTTPError{http.StatusInternalServerError, "Couldn't parse actor."}
|
||||||
}
|
}
|
||||||
|
baseActor := &activitystreams.Person{}
|
||||||
|
if err := unmarshalActor(actorResp, baseActor); err != nil {
|
||||||
|
log.Error("Unable to unmarshal actual actor! %v", err)
|
||||||
|
return nil, nil, impart.HTTPError{http.StatusInternalServerError, "Couldn't parse actual actor."}
|
||||||
|
}
|
||||||
|
// Fetch the actual actor using the owner field from the publicKey object
|
||||||
|
actualActorResp, err := resolveIRI(app.cfg.App.Host, baseActor.PublicKey.Owner)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("Unable to get actual actor! %v", err)
|
||||||
|
return nil, nil, impart.HTTPError{http.StatusInternalServerError, "Couldn't fetch actual actor."}
|
||||||
|
}
|
||||||
|
if err := unmarshalActor(actualActorResp, actor); err != nil {
|
||||||
|
log.Error("Unable to unmarshal actual actor! %v", err)
|
||||||
|
return nil, nil, impart.HTTPError{http.StatusInternalServerError, "Couldn't parse actual actor."}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue