From 74e47b7d04b7c593945c9aa03288528a5cf7f16a Mon Sep 17 00:00:00 2001 From: Tzahi12345 Date: Sun, 3 May 2020 19:34:01 -0400 Subject: [PATCH] Fixed bug that prevented audio files from being played after username change Downloads with custom args or custom quality config now use the old downloader to ensure stability and prevent arg conflict --- backend/app.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/app.js b/backend/app.js index dec38e8..84542fc 100644 --- a/backend/app.js +++ b/backend/app.js @@ -1540,7 +1540,6 @@ async function generateArgs(url, type, options) { } // downloadConfig.map((arg) => `"${arg}"`); - console.log(downloadConfig.toString()) resolve(downloadConfig); }); } @@ -1860,7 +1859,7 @@ app.post('/api/tomp3', optionalJwt, async function(req, res) { } const is_playlist = url.includes('playlist'); - if (is_playlist || options.customQualityConfiguration ) + if (is_playlist || options.customQualityConfiguration || options.customArgs || options.maxBitrate) result_obj = await downloadFileByURL_exec(url, 'audio', options, req.query.sessionID); else result_obj = await downloadFileByURL_normal(url, 'audio', options, req.query.sessionID); @@ -1888,7 +1887,7 @@ app.post('/api/tomp4', optionalJwt, async function(req, res) { const is_playlist = url.includes('playlist'); let result_obj = null; - if (is_playlist || options.customQualityConfiguration) + if (is_playlist || options.customQualityConfiguration || options.customArgs || options.selectedHeight) result_obj = await downloadFileByURL_exec(url, 'video', options, req.query.sessionID); else result_obj = await downloadFileByURL_normal(url, 'video', options, req.query.sessionID); @@ -2664,7 +2663,7 @@ app.get('/api/audio/:id', optionalJwt, function(req , res){ let file_path = "audio/" + id + '.mp3'; if (req.isAuthenticated()) { let usersFileFolder = config_api.getConfigItem('ytdl_users_base_path'); - file_path = path.join(usersFileFolder, req.user.name, 'audio', id + '.mp3'); + file_path = path.join(usersFileFolder, req.user.uid, 'audio', id + '.mp3'); } file_path = file_path.replace(/\"/g, '\''); const stat = fs.statSync(file_path)