From 6df86fa9d1b6bd4c234a2aa7c27c6056b37b5f55 Mon Sep 17 00:00:00 2001 From: 0xKermini <67284748+lukebaze@users.noreply.github.com> Date: Thu, 26 Mar 2026 16:19:32 +0700 Subject: [PATCH] refactor(configuration): port 0 treated as falsy in getvalidport validation The condition `if (port)` treats port 0 as falsy, causing it to bypass port validation and call getFreePort() instead. Port 0 is a valid network port (meaning 'any available port'), but this logic incorrectly treats it as 'no port specified'. Users explicitly configuring port 0 will get unexpected behavior. Affected files: utils.ts Signed-off-by: 0xKermini <67284748+lukebaze@users.noreply.github.com> --- src/configuration/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/configuration/utils.ts b/src/configuration/utils.ts index 2588872ba20..079569adb83 100644 --- a/src/configuration/utils.ts +++ b/src/configuration/utils.ts @@ -25,7 +25,7 @@ export async function getValidHostname (hostname: string): Promise { } export async function getValidPort (port: number): Promise { - if (port) { + if (port >= 0) { const isFree = await isFreePort(port); if (!isFree)