1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

[PM-26096] Bugfix: Decryption errors for folders prevent vault access (#16796)

* Handle scenario where folders fail to decrypt

* Add comment explaining the folderViews$ filter check
This commit is contained in:
Nik Gilmore
2025-10-09 10:46:20 -07:00
committed by GitHub
parent 78e5e029b6
commit 4d2106a7c0
2 changed files with 16 additions and 8 deletions

View File

@@ -272,11 +272,16 @@ export class FolderService implements InternalFolderServiceAbstraction {
return [];
}
const decryptFolderPromises = folders.map((f) =>
f.decryptWithKey(userKey, this.encryptService),
);
const decryptedFolders = await Promise.all(decryptFolderPromises);
decryptedFolders.sort(Utils.getSortFunction(this.i18nService, "name"));
const decryptFolderPromises = folders.map(async (f) => {
try {
return await f.decryptWithKey(userKey, this.encryptService);
} catch {
return null;
}
});
const decryptedFolders = (await Promise.all(decryptFolderPromises))
.filter((p) => p !== null)
.sort(Utils.getSortFunction(this.i18nService, "name"));
const noneFolder = new FolderView();
noneFolder.name = this.i18nService.t("noneFolder");