From 3482268ccd3b2c397e8eff57e24f43bb2f48490c Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Mon, 27 Oct 2025 17:29:00 +0100 Subject: [PATCH] Fix type error --- .../common/src/vault/models/domain/attachment.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libs/common/src/vault/models/domain/attachment.ts b/libs/common/src/vault/models/domain/attachment.ts index 77acbbeb9bb..019eccb5d24 100644 --- a/libs/common/src/vault/models/domain/attachment.ts +++ b/libs/common/src/vault/models/domain/attachment.ts @@ -91,12 +91,18 @@ export class Attachment extends Domain { } } - private async getKeyForDecryption(orgId: string | undefined, userId: UserId): Promise { + private async getKeyForDecryption( + orgId: string | undefined, + userId: UserId, + ): Promise { const keyService = Utils.getContainerService().getKeyService(); - console.log("getKeyForDecryption", orgId, userId); - return orgId != null ? await firstValueFrom(keyService.orgKeys$(userId).pipe( - map((orgKeys) => orgKeys[orgId as OrganizationId] ?? null), - )) : await firstValueFrom(keyService.userKey$(userId)); + return orgId != null + ? await firstValueFrom( + keyService + .orgKeys$(userId) + .pipe(map((orgKeys) => (orgKeys ? (orgKeys[orgId as OrganizationId] ?? null) : null))), + ) + : await firstValueFrom(keyService.userKey$(userId)); } toAttachmentData(): AttachmentData {