diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/activitypub/actor.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts index 7494aadbb..c708b38ba 100644 --- a/server/lib/activitypub/actor.ts +++ b/server/lib/activitypub/actor.ts | |||
@@ -252,7 +252,7 @@ async function fetchRemoteActor (actorUrl: string): Promise<FetchRemoteActorResu | |||
252 | logger.info('Fetching remote actor %s.', actorUrl) | 252 | logger.info('Fetching remote actor %s.', actorUrl) |
253 | 253 | ||
254 | const requestResult = await doRequest(options) | 254 | const requestResult = await doRequest(options) |
255 | const actorJSON: ActivityPubActor = requestResult.body | 255 | const actorJSON: ActivityPubActor = normalizeActor(requestResult.body) |
256 | 256 | ||
257 | if (isActorObjectValid(actorJSON) === false) { | 257 | if (isActorObjectValid(actorJSON) === false) { |
258 | logger.debug('Remote actor JSON is not valid.', { actorJSON: actorJSON }) | 258 | logger.debug('Remote actor JSON is not valid.', { actorJSON: actorJSON }) |
@@ -358,3 +358,10 @@ async function refreshActorIfNeeded (actor: ActorModel) { | |||
358 | return actor | 358 | return actor |
359 | }) | 359 | }) |
360 | } | 360 | } |
361 | |||
362 | function normalizeActor (actor: any) { | ||
363 | if (actor && actor.url && typeof actor.url === 'string') return actor | ||
364 | |||
365 | actor.url = actor.url.href || actor.url.url | ||
366 | return actor | ||
367 | } | ||