From 4f4372b65a1a9783a93d7c3f9afd7904082822cc Mon Sep 17 00:00:00 2001 From: Araxeus <78568641+Araxeus@users.noreply.github.com> Date: Sun, 19 Mar 2023 20:23:09 +0200 Subject: [PATCH] fix PR review comments --- plugins/downloader/back.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/downloader/back.js b/plugins/downloader/back.js index 7dd16d08..c5743cf2 100644 --- a/plugins/downloader/back.js +++ b/plugins/downloader/back.js @@ -85,6 +85,7 @@ module.exports = async (win_, options) => { }; module.exports.downloadSong = downloadSong; +module.exports.downloadPlaylist = downloadPlaylist; async function downloadSong( url, @@ -312,12 +313,10 @@ async function writeID3(buffer, metadata, sendFeedback) { } async function downloadPlaylist(givenUrl) { - if (givenUrl) { - try { - givenUrl = new URL(givenUrl); - } catch { - givenUrl = undefined; - } + try { + givenUrl = new URL(givenUrl); + } catch { + givenUrl = undefined; } const playlistId = getPlaylistID(givenUrl) || @@ -465,7 +464,7 @@ const getPlaylistID = (aURL) => { const result = aURL?.searchParams.get('list') || aURL?.searchParams.get('playlist'); if (result?.startsWith(INVALID_PLAYLIST_MODIFIER)) { - return result.slice(6); + return result.slice(INVALID_PLAYLIST_MODIFIER.length); } return result; };