From 1ab5ceb65aab5170a556e1880ea07b6eccc5d710 Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Mon, 26 May 2025 11:34:46 -0400 Subject: [PATCH] fix ID checks in resolveCollectionItems --- .../backend/src/core/activitypub/ApResolverService.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/core/activitypub/ApResolverService.ts b/packages/backend/src/core/activitypub/ApResolverService.ts index 1b4fed4461..6b95d9c93b 100644 --- a/packages/backend/src/core/activitypub/ApResolverService.ts +++ b/packages/backend/src/core/activitypub/ApResolverService.ts @@ -93,12 +93,12 @@ export class Resolver { const items: IObjectWithId[] = []; const collectionObj = await this.resolveCollection(collection); - await this.resolveCollectionItemsTo(collectionObj, limit ?? undefined, allowAnonymousItems, collectionObj.id, items); + await this.resolveCollectionItemsTo(collectionObj, limit ?? undefined, allowAnonymousItems, items); return items; } - private async resolveCollectionItemsTo(current: AnyCollection | null, limit: number | undefined, allowAnonymousItems: boolean | undefined, sourceUri: string | undefined, destination: IObjectWithId[]): Promise { + private async resolveCollectionItemsTo(current: AnyCollection | null, limit: number | undefined, allowAnonymousItems: boolean | undefined, destination: IObjectWithId[]): Promise { // This is pulled up to avoid code duplication below const iterate = async(items: ApObject): Promise => { for (const item of toArray(items)) { @@ -109,8 +109,8 @@ export class Resolver { if (limit != null && limit < 1) break; // Use secureResolve whenever possible, to avoid re-fetching items that were included inline. - const resolved = (sourceUri && !allowAnonymousItems) - ? await this.secureResolve(item, sourceUri) + const resolved = current?.id + ? await this.secureResolve(item, current.id, allowAnonymousItems) : await this.resolve(getApId(item), allowAnonymousItems); destination.push(resolved);