fix url validation for base64 encoded playlists, we should skip for these kinda playlists it but im keeping it in for now

This commit is contained in:
Exodus-MW 2024-06-17 00:15:35 +05:30
parent 964cddcae5
commit 3e0040b58a

View file

@ -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);