From 3e0040b58a272a613f51d0ddfdb69d914da0a778 Mon Sep 17 00:00:00 2001 From: Exodus-MW Date: Mon, 17 Jun 2024 00:15:35 +0530 Subject: [PATCH] fix url validation for base64 encoded playlists, we should skip for these kinda playlists it but im keeping it in for now --- src/fetchers/common.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/fetchers/common.ts b/src/fetchers/common.ts index 71956ba..fbdf74e 100644 --- a/src/fetchers/common.ts +++ b/src/fetchers/common.ts @@ -15,7 +15,11 @@ export function makeFullUrl(url: string, ops?: FullUrlOptions): string { if (rightSide.startsWith('/')) rightSide = rightSide.slice(1); const fullUrl = leftSide + rightSide; - if (!fullUrl.startsWith('http://') && !fullUrl.startsWith('https://')) + + // we need the data scheme for base64 encoded hls playlists + // this is for playlists that themselves have cors but not their parts + // this allows us to proxy them, encode them into base64 and then fetch the parts normally + if (!fullUrl.startsWith('http://') && !fullUrl.startsWith('https://') && !fullUrl.startsWith('data:')) throw new Error(`Invald URL -- URL doesn't start with a http scheme: '${fullUrl}'`); const parsedUrl = new URL(fullUrl);