From 08c142cfff1216a11d62711658044886f496b142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n=20Ainsworth?= Date: Wed, 22 Nov 2023 10:01:14 +0000 Subject: [PATCH] fix(front): Fixed regex order in embed Part-of: --- changes/changelog.d/embed-regex.bugfix | 1 + front/public/embed.html | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changes/changelog.d/embed-regex.bugfix diff --git a/changes/changelog.d/embed-regex.bugfix b/changes/changelog.d/embed-regex.bugfix new file mode 100644 index 000000000..83e033937 --- /dev/null +++ b/changes/changelog.d/embed-regex.bugfix @@ -0,0 +1 @@ +Fixed issue with regular expression in embed. diff --git a/front/public/embed.html b/front/public/embed.html index 39bca4c9a..8e367ada3 100644 --- a/front/public/embed.html +++ b/front/public/embed.html @@ -82,7 +82,8 @@ // that do not support other codecs to be able to play it :) if (sources.length > 0 && !sources.some(({ mimetype }) => mimetype === 'audio/mpeg')) { const source = sources[0].listen_url - const url = new URL(source.test(/^https?:/) + const regex = /^https?:/ + const url = new URL(regex.test(source) ? source : source[0] === '/' ? `${baseUrl}${source}`