From fb44a6558fdc1ab77f45ffc51a4113fd27c884f2 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Wed, 3 Nov 2021 03:29:57 +0200 Subject: [PATCH] fix(phisherman): fix api response handling issue when checking subdomains --- backend/src/data/Phisherman.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/src/data/Phisherman.ts b/backend/src/data/Phisherman.ts index c50f67b1..5f95f347 100644 --- a/backend/src/data/Phisherman.ts +++ b/backend/src/data/Phisherman.ts @@ -129,10 +129,11 @@ async function fetchDomainInfo(domain: string): Promise>("GET", `/v2/domains/info/${domain}`); - const domainInfo = result[domain]; + const firstKey = Object.keys(result)[0]; + const domainInfo = firstKey ? result[firstKey] : null; if (!domainInfo) { // tslint:disable-next-line:no-console - console.warn("Unexpected Phisherman API response:", result); + console.warn(`Unexpected Phisherman API response for ${domain}:`, result); return null; } if (domainInfo.classification === "unknown") {