fix(front): Fixed regex order in embed

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2642>
This commit is contained in:
Ciarán Ainsworth 2023-11-22 10:01:14 +00:00 committed by Marge
parent a0ae9bbb70
commit 08c142cfff
2 changed files with 3 additions and 1 deletions

View File

@ -0,0 +1 @@
Fixed issue with regular expression in embed.

View File

@ -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}`