From 5213a599fea0da64560f935dffbf6b27a39d4850 Mon Sep 17 00:00:00 2001 From: Maximilian Krambach Date: Thu, 12 Jul 2018 11:48:17 +0200 Subject: [PATCH] js: allow optional Key retrieve pattern to be null -- * src/Keyring.js: If the optional "pattern" parameter is not to be used, but another, following parameter is, null is more of a convention in javascript, thus both null and undefined are interpreted as "this parameter is not meant to be set". --- lang/js/src/Keyring.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lang/js/src/Keyring.js b/lang/js/src/Keyring.js index 7a33be98..cefc8123 100644 --- a/lang/js/src/Keyring.js +++ b/lang/js/src/Keyring.js @@ -53,7 +53,7 @@ export class GPGME_Keyring { getKeys(pattern, prepare_sync=false, search=false){ return new Promise(function(resolve, reject) { let msg = createMessage('keylist'); - if (pattern !== undefined){ + if (pattern !== undefined && pattern !== null){ msg.setParameter('keys', pattern); } msg.setParameter('sigs', true); @@ -136,7 +136,7 @@ export class GPGME_Keyring { if (with_secret_fpr === true) { msg.setParameter('with-sec-fprs', true); } - if (pattern !== undefined){ + if (pattern !== undefined && pattern !== null){ msg.setParameter('keys', pattern); } msg.post().then(function(answer){