From a7c17c195b357b7db083a92a27a8bc42ec33720e Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Mon, 25 Dec 2023 18:03:07 -0700 Subject: [PATCH] music: fetch again with get if head fails --- src/modules/music.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/modules/music.js b/src/modules/music.js index 0bad032..4ba712f 100644 --- a/src/modules/music.js +++ b/src/modules/music.js @@ -574,9 +574,16 @@ command.callback = async function ( } } else { if (argStr.match(/^https?:\/\//)) { - const contentType = await fetch(argStr, {method: "HEAD"}).then( + let contentType = await fetch(argStr, {method: "HEAD"}).then( (res) => res.headers.get("Content-Type") ); + + if (!contentType) { + contentType = await fetch(argStr, {method: "GET"}).then((res) => + res.headers.get("Content-Type") + ); + } + if ( contentType.startsWith("audio/") || contentType.startsWith("video/")