diff --git a/src/main/index.js b/src/main/index.js index 2f8944c88df09..52e27df5a75d5 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -103,17 +103,17 @@ function runApp() { let url if (toYouTube) { - url = `https://youtu.be/${id}` + url = new URL(`https://youtu.be/${id}`) } else { - url = `https://redirect.invidious.io/watch?v=${id}` + url = new URL(`https://redirect.invidious.io/watch?v=${id}`) } if (query) { const params = new URLSearchParams(query) - const newParams = new URLSearchParams() + const newParams = new URLSearchParams(url.search) let hasParams = false - if (params.has('playlistId')) { + if (params.has('playlistId') && params.get('playlistType') !== 'user') { newParams.set('list', params.get('playlistId')) hasParams = true } @@ -124,11 +124,11 @@ function runApp() { } if (hasParams) { - url += '?' + newParams.toString() + url.search = newParams.toString() } } - return url + return url.toString() } } }