From 967d7fe63a2e09585c9775ad8accdef801d19215 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sat, 20 Jan 2024 12:48:28 -0300 Subject: [PATCH] normalizeURL prepends ws:// when necessary. --- utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/utils.ts b/utils.ts index 7f30dfa..2e40643 100644 --- a/utils.ts +++ b/utils.ts @@ -4,6 +4,7 @@ export const utf8Decoder = new TextDecoder('utf-8') export const utf8Encoder = new TextEncoder() export function normalizeURL(url: string): string { + if (url.indexOf('://') === -1) url = 'wss://' + url let p = new URL(url) p.pathname = p.pathname.replace(/\/+/g, '/') if (p.pathname.endsWith('/')) p.pathname = p.pathname.slice(0, -1)