From da73e47f089d19e28c7debdf50524480c86da675 Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Fri, 14 Aug 2020 20:04:40 -0400 Subject: [PATCH] Fixes bug where an error would occur on startup if a user's file folder was missing (such as "{user}/audio" if they had not downloaded any audio files) --- backend/utils.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/utils.js b/backend/utils.js index f5dd47b..034ce3c 100644 --- a/backend/utils.js +++ b/backend/utils.js @@ -20,6 +20,9 @@ function getTrueFileName(unfixed_path, type) { } function getDownloadedFilesByType(basePath, type) { + // return empty array if the path doesn't exist + if (!fs.existsSync(basePath)) return []; + let files = []; const ext = type === 'audio' ? 'mp3' : 'mp4'; var located_files = recFindByExt(basePath, ext);