mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-12 04:11:43 +00:00
Ensure folder exists in library
This commit is contained in:
parent
da82e2117b
commit
184858efae
2 changed files with 4 additions and 2 deletions
|
|
@ -49,7 +49,8 @@ class MiscController {
|
||||||
return res.status(404).send(`Library not found with id ${libraryId}`)
|
return res.status(404).send(`Library not found with id ${libraryId}`)
|
||||||
}
|
}
|
||||||
const folder = await Database.libraryFolderModel.findByPk(folderId)
|
const folder = await Database.libraryFolderModel.findByPk(folderId)
|
||||||
if (!folder) {
|
// Verify the folder matches the library ID so we don't accidentally add a podcast to the wrong path
|
||||||
|
if (!folder || folder.libraryId !== library.id) {
|
||||||
return res.status(404).send(`Folder not found with id ${folderId} in library ${library.name}`)
|
return res.status(404).send(`Folder not found with id ${folderId} in library ${library.name}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,8 @@ class PodcastController {
|
||||||
}
|
}
|
||||||
|
|
||||||
const folder = await Database.libraryFolderModel.findByPk(payload.folderId)
|
const folder = await Database.libraryFolderModel.findByPk(payload.folderId)
|
||||||
if (!folder) {
|
// Verify the folder matches the library ID so we don't accidentally add a podcast to the wrong path
|
||||||
|
if (!folder || folder.libraryId !== library.id) {
|
||||||
Logger.error(`[PodcastController] Create: Folder not found "${payload.folderId}"`)
|
Logger.error(`[PodcastController] Create: Folder not found "${payload.folderId}"`)
|
||||||
return res.status(404).send('Folder not found')
|
return res.status(404).send('Folder not found')
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue