fix(front): Fixed regex order in embed

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2642>
environments/review-docs-2085-h577jp/deployments/18808
Ciarán Ainsworth 2023-11-22 10:01:14 +00:00 zatwierdzone przez Marge
rodzic a0ae9bbb70
commit 08c142cfff
2 zmienionych plików z 3 dodań i 1 usunięć

Wyświetl plik

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

Wyświetl plik

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