From 6e0e6f587bc2bebb865bf7b33608a1e5efd20304 Mon Sep 17 00:00:00 2001 From: Viren070 Date: Mon, 29 Sep 2025 20:25:27 +0100 Subject: [PATCH] fix: add error handling for URL parsing in Proxifier class --- packages/core/src/streams/proxifier.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/core/src/streams/proxifier.ts b/packages/core/src/streams/proxifier.ts index ce708296..02a3d4c3 100644 --- a/packages/core/src/streams/proxifier.ts +++ b/packages/core/src/streams/proxifier.ts @@ -20,8 +20,18 @@ class Proxifier { if (stream.proxied) { return false; } - const streamUrl = new URL(stream.url); - const proxyUrl = new URL(proxy.url); + let streamUrl: URL; + let proxyUrl: URL; + try { + streamUrl = new URL(stream.url); + proxyUrl = new URL(proxy.url); + } catch (error) { + logger.error( + `URL parsing failed somehow: stream: ${JSON.stringify(stream)}, proxy: ${JSON.stringify(proxy)}` + ); + logger.error(error); + return false; + } if ( streamUrl.host === proxyUrl.host && // check for proxy endpoint for stremthru, not needed for mediaflow as all mediaflow links are proxied