From f6c4214042c68de137a69aa15dea81ed9cbc822a Mon Sep 17 00:00:00 2001 From: Matt Kane Date: Tue, 10 Dec 2024 20:00:58 +0000 Subject: [PATCH] fix: correctly check isOnline with port (#12706) --- .changeset/wild-ducks-decide.md | 5 +++++ packages/upgrade/src/actions/verify.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/wild-ducks-decide.md diff --git a/.changeset/wild-ducks-decide.md b/.changeset/wild-ducks-decide.md new file mode 100644 index 0000000000..8a6f85be73 --- /dev/null +++ b/.changeset/wild-ducks-decide.md @@ -0,0 +1,5 @@ +--- +'@astrojs/upgrade': patch +--- + +Fixes a bug that caused registry URLs that specify a port to be incorrectly detected as offline. diff --git a/packages/upgrade/src/actions/verify.ts b/packages/upgrade/src/actions/verify.ts index 384df5134a..3b7c15a9e1 100644 --- a/packages/upgrade/src/actions/verify.ts +++ b/packages/upgrade/src/actions/verify.ts @@ -43,8 +43,8 @@ export async function verify( } function isOnline(registry: string): Promise { - const { host } = new URL(registry); - return dns.lookup(host).then( + const { hostname } = new URL(registry); + return dns.lookup(hostname).then( () => true, () => false, );