mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-14 09:58:20 +01:00
Fix:Crash when updating sequence on series #1919
This commit is contained in:
parent
b715ef3bfc
commit
d0cd512be8
@ -100,6 +100,7 @@ class LibraryItemController {
|
|||||||
async updateMedia(req, res) {
|
async updateMedia(req, res) {
|
||||||
const libraryItem = req.libraryItem
|
const libraryItem = req.libraryItem
|
||||||
const mediaPayload = req.body
|
const mediaPayload = req.body
|
||||||
|
|
||||||
// Item has cover and update is removing cover so purge it from cache
|
// Item has cover and update is removing cover so purge it from cache
|
||||||
if (libraryItem.media.coverPath && (mediaPayload.coverPath === '' || mediaPayload.coverPath === null)) {
|
if (libraryItem.media.coverPath && (mediaPayload.coverPath === '' || mediaPayload.coverPath === null)) {
|
||||||
await this.cacheManager.purgeCoverCache(libraryItem.id)
|
await this.cacheManager.purgeCoverCache(libraryItem.id)
|
||||||
|
@ -119,7 +119,7 @@ module.exports = (sequelize) => {
|
|||||||
{
|
{
|
||||||
model: sequelize.models.series,
|
model: sequelize.models.series,
|
||||||
through: {
|
through: {
|
||||||
attributes: ['sequence']
|
attributes: ['id', 'sequence']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -220,7 +220,7 @@ module.exports = (sequelize) => {
|
|||||||
hasUpdates = true
|
hasUpdates = true
|
||||||
} else if (existingSeriesMatch.bookSeries.sequence !== updatedSeries.sequence) {
|
} else if (existingSeriesMatch.bookSeries.sequence !== updatedSeries.sequence) {
|
||||||
Logger.dev(`[LibraryItem] "${libraryItemExpanded.media.title}" series "${updatedSeries.name}" sequence was updated from "${existingSeriesMatch.bookSeries.sequence}" to "${updatedSeries.sequence}"`)
|
Logger.dev(`[LibraryItem] "${libraryItemExpanded.media.title}" series "${updatedSeries.name}" sequence was updated from "${existingSeriesMatch.bookSeries.sequence}" to "${updatedSeries.sequence}"`)
|
||||||
await existingSeriesMatch.bookSeries.update({ sequence: updatedSeries.sequence })
|
await existingSeriesMatch.bookSeries.update({ id: updatedSeries.id, sequence: updatedSeries.sequence })
|
||||||
hasUpdates = true
|
hasUpdates = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user