From fae681747da04c1a95c1dcaa56f9da8371034792 Mon Sep 17 00:00:00 2001 From: DevBot Date: Sat, 21 Feb 2026 08:56:37 +0000 Subject: [PATCH] fix: handle default ports in gateway URL validation JavaScript's URL API omits .port for standard ports (443 for wss:, 80 for ws:) even when explicitly specified. This caused valid URLs like wss://host.ts.net:443 to fail validation with 'Gateway URL must include an explicit port.' Fix by checking default ports when url.port is empty. Closes #148 --- frontend/src/lib/gateway-form.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/gateway-form.ts b/frontend/src/lib/gateway-form.ts index 7832c03e..e247f39e 100644 --- a/frontend/src/lib/gateway-form.ts +++ b/frontend/src/lib/gateway-form.ts @@ -12,7 +12,10 @@ export const validateGatewayUrl = (value: string) => { if (url.protocol !== "ws:" && url.protocol !== "wss:") { return "Gateway URL must start with ws:// or wss://."; } - if (!url.port) { + // url.port is empty for default ports (80 for ws:, 443 for wss:) — allow those + const defaultPorts: Record = { "ws:": "80", "wss:": "443" }; + const effectivePort = url.port || defaultPorts[url.protocol] || ""; + if (!effectivePort) { return "Gateway URL must include an explicit port."; } return null;