From e8b0803c97ee862e0e95ca6f7b9361935fb68947 Mon Sep 17 00:00:00 2001 From: SmithThe4th Date: Tue, 20 Jan 2026 09:43:29 -0500 Subject: [PATCH] Set error cannot decrypt when collection name cannot be decrypted (#18443) --- .../models/collections/collection-admin.view.ts | 2 +- .../admin-console/models/collections/collection.view.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libs/common/src/admin-console/models/collections/collection-admin.view.ts b/libs/common/src/admin-console/models/collections/collection-admin.view.ts index 65486136922..5ae901d5089 100644 --- a/libs/common/src/admin-console/models/collections/collection-admin.view.ts +++ b/libs/common/src/admin-console/models/collections/collection-admin.view.ts @@ -121,13 +121,13 @@ export class CollectionAdminView extends CollectionView { try { view.name = await encryptService.decryptString(new EncString(view.name), orgKey); } catch (e) { + view.name = "[error: cannot decrypt]"; // Note: This should be replaced by the owning team with appropriate, domain-specific behavior. // eslint-disable-next-line no-console console.error( "[CollectionAdminView/fromCollectionAccessDetails] Error decrypting collection name", e, ); - throw e; } view.assigned = collection.assigned; view.readOnly = collection.readOnly; diff --git a/libs/common/src/admin-console/models/collections/collection.view.ts b/libs/common/src/admin-console/models/collections/collection.view.ts index 2991e8bb171..eabd4dc7b36 100644 --- a/libs/common/src/admin-console/models/collections/collection.view.ts +++ b/libs/common/src/admin-console/models/collections/collection.view.ts @@ -126,7 +126,14 @@ export class CollectionView implements View, ITreeNodeObject { ): Promise { const view = new CollectionView({ ...collection, name: "" }); - view.name = await encryptService.decryptString(collection.name, key); + try { + view.name = await encryptService.decryptString(collection.name, key); + } catch (e) { + view.name = "[error: cannot decrypt]"; + // eslint-disable-next-line no-console + console.error("[CollectionView] Error decrypting collection name", e); + } + view.assigned = true; view.externalId = collection.externalId; view.readOnly = collection.readOnly;