From 4a7983b61c4ef4387b925c0db53f0068fb0bae8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Rame=CC=81?= Date: Sat, 24 Feb 2024 04:01:51 +0100 Subject: [PATCH] fix: the second page per website to analyze had url wrong + add verification of successful status code --- src/features/domain.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/features/domain.ts b/src/features/domain.ts index 63ec7a2..81dcc95 100644 --- a/src/features/domain.ts +++ b/src/features/domain.ts @@ -603,7 +603,7 @@ export async function updateWebsiteDataOnDomains() { let anotherPageData: getWebsiteDataResponse; try { - anotherPageData = await getWebsiteData(browser, url.toString(), 5000); + anotherPageData = await getWebsiteData(browser, anotherPageUrl.toString(), 5000); } catch (error) { if (error instanceof Error) { handleReachabilityError(error); @@ -615,7 +615,9 @@ export async function updateWebsiteDataOnDomains() { } } - anotherPageTitle = anotherPageData.title; + if (anotherPageData.status >= 200 && anotherPageData.status < 300) { + anotherPageTitle = anotherPageData.title; + } break; }