From 3c6759ba1cf0441d0bbc39c51c1851cb662d4455 Mon Sep 17 00:00:00 2001
From: Benoit Lavenier <benoit.lavenier@e-is.pro>
Date: Mon, 15 May 2023 16:27:15 +0200
Subject: [PATCH] Simplify read of ?pubkey query param, in
 /wot/requirements/:search

---
 app/modules/bma/lib/controllers/wot.ts | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/app/modules/bma/lib/controllers/wot.ts b/app/modules/bma/lib/controllers/wot.ts
index 99dda6b48..b5196aa51 100644
--- a/app/modules/bma/lib/controllers/wot.ts
+++ b/app/modules/bma/lib/controllers/wot.ts
@@ -189,8 +189,7 @@ export class WOTBinding extends AbstractController {
     const search = await ParametersService.getSearchP(req);
     let identities: any = [];
     if (req.query.pubkey) {
-      const matches = search.match(BMAConstants.PUBLIC_KEY);
-      if (!matches) {
+      if (!BMAConstants.PUBLIC_KEY.test(search)) {
         throw BMAConstants.ERRORS.NO_IDTY_MATCHING_PUB_OR_UID;
       }
       identities = await this.IdentityService.searchIdentitiesByPubkey(search);
-- 
GitLab