Skip to content

Commit f37c3ae

Browse files
committed
Remove URL check which fails on relative URLs
1 parent a060d3f commit f37c3ae

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

music_html5.c

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -340,25 +340,8 @@ static void *MusicHTML5_CreateFromFile(const char *file)
340340
url = Module["SDL2Mixer"].createBlob(buf);
341341
} catch(e) {
342342
// Fail silently, presume file not in FS.
343-
// Assume it's a URL
344-
function isValidUrl(string) {
345-
let url;
346-
347-
try {
348-
url = new URL(string);
349-
} catch (_) {
350-
return false;
351-
}
352-
353-
return url.protocol === "http:" || url.protocol === "https:";
354-
}
355-
356-
if (isValidUrl(file))
357-
url = file;
358-
else {
359-
Module["printErr"](`URL ${url} is invalid`);
360-
return -1;
361-
}
343+
// Assume it's a relative or absolute URL
344+
url = file;
362345
}
363346

364347
const id = Module["SDL2Mixer"].createMusic(url, context);

0 commit comments

Comments
 (0)