From ec13cfd70c447d7e082023a04d5f2ec9a34cd1b5 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Tue, 19 Oct 2021 16:11:48 +0200 Subject: [PATCH] Pick first cipher matching url as no specific cipher was selected by the user when vault is locked --- src/background/contextMenus.background.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/background/contextMenus.background.ts b/src/background/contextMenus.background.ts index a9173f2dfed..609081b2b72 100644 --- a/src/background/contextMenus.background.ts +++ b/src/background/contextMenus.background.ts @@ -80,8 +80,16 @@ export default class ContextMenusBackground { return; } - const ciphers = await this.cipherService.getAllDecrypted(); - const cipher = ciphers.find(c => c.id === id); + let cipher: CipherView; + if (id === 'noop') { + const ciphers = await this.cipherService.getAllDecryptedForUrl(tab.url); + cipher = ciphers.length > 0 ? ciphers[0] : null; + } + else { + const ciphers = await this.cipherService.getAllDecrypted(); + cipher = ciphers.find(c => c.id === id); + } + if (cipher == null) { return; }