fixes 404 for own private profile

This commit is contained in:
Christian Beutel
2025-06-24 15:15:35 +02:00
parent 8e3eea6216
commit cb4f4f8125
2 changed files with 15 additions and 6 deletions

View File

@@ -1050,11 +1050,19 @@ func registerRoutes(se *core.ServeEvent, client meilisearch.ServiceManager) {
actor, err = federation.GetActorByIRI(e.App, iri, follows)
}
if err != nil && actor == nil {
if strings.HasPrefix(err.Error(), "webfinger") || err.Error() == "profile is private" {
if strings.HasPrefix(err.Error(), "webfinger") {
return e.NotFoundError("Not found", err)
}
return err
} else if err != nil && actor != nil {
if err.Error() == "profile is private" {
// this is our own profile
if actor.GetString("user") == e.Auth.Id {
return e.JSON(http.StatusOK, map[string]any{"actor": actor, "error": nil})
} else {
return e.JSON(http.StatusNotFound, map[string]any{"error": "profile is private"})
}
}
// we could not fetch the remote actor so we return our local cached copy
return e.JSON(http.StatusOK, map[string]any{"actor": actor, "error": err.Error()})
}