From 8c759dde6c67c86871e002883aacc24531b309d8 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Thu, 15 Dec 2022 19:44:55 +0100 Subject: [PATCH] server: fix error about duplicate resolve --- .../backend/src/remote/activitypub/models/person.ts | 10 ++++------ packages/backend/src/server/api/endpoints/ap/show.ts | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/backend/src/remote/activitypub/models/person.ts b/packages/backend/src/remote/activitypub/models/person.ts index 3cf50eda9..0136aeea3 100644 --- a/packages/backend/src/remote/activitypub/models/person.ts +++ b/packages/backend/src/remote/activitypub/models/person.ts @@ -129,14 +129,12 @@ export async function fetchPerson(uri: string, resolver: Resolver): Promise { - if (typeof uri !== 'string') throw new Error('uri is not string'); - - if (uri.startsWith(config.url)) { +export async function createPerson(value: string | IObject, resolver: Resolver): Promise { + if (getApId(value).startsWith(config.url)) { throw new StatusError('cannot resolve local user', 400, 'cannot resolve local user'); } - const object = await resolver.resolve(uri) as any; + const object = await resolver.resolve(value) as any; const person = validateActor(object); @@ -272,7 +270,7 @@ export async function createPerson(uri: string, resolver: Resolver): Promise