From fc276b330a602fe6f4728d612ffd434b39b740f0 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sun, 1 Sep 2024 07:35:05 -0500 Subject: [PATCH] Fix:Server crash when uploading or adding new podcast #3353 --- server/controllers/MiscController.js | 2 +- server/controllers/PodcastController.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/controllers/MiscController.js b/server/controllers/MiscController.js index d9c1c445..f3dd0c6d 100644 --- a/server/controllers/MiscController.js +++ b/server/controllers/MiscController.js @@ -44,7 +44,7 @@ class MiscController { const files = Object.values(req.files) const { title, author, series, folder: folderId, library: libraryId } = req.body - const library = await Database.libraryModel.findByPk(libraryId) + const library = await Database.libraryModel.findByIdWithFolders(libraryId) if (!library) { return res.status(404).send(`Library not found with id ${libraryId}`) } diff --git a/server/controllers/PodcastController.js b/server/controllers/PodcastController.js index 976e1ac9..3610c2ea 100644 --- a/server/controllers/PodcastController.js +++ b/server/controllers/PodcastController.js @@ -38,7 +38,7 @@ class PodcastController { } const payload = req.body - const library = await Database.libraryModel.findByPk(payload.libraryId) + const library = await Database.libraryModel.findByIdWithFolders(payload.libraryId) if (!library) { Logger.error(`[PodcastController] Create: Library not found "${payload.libraryId}"`) return res.status(404).send('Library not found')