mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-24 09:49:24 +02:00
Fix:Set full cover path for extracted covers & use temp fix to update books without a full cover path
This commit is contained in:
parent
d6ae50f89a
commit
57b464c867
3 changed files with 31 additions and 3 deletions
|
@ -234,13 +234,23 @@ class BookController {
|
|||
async getCover(req, res) {
|
||||
let { query: { width, height, format }, params: { id } } = req
|
||||
var audiobook = this.db.audiobooks.find(a => a.id === id)
|
||||
if (!audiobook || (!audiobook.book.coverFullPath && !audiobook.book.cover)) return res.sendStatus(404)
|
||||
if (!audiobook || !audiobook.book.cover) return res.sendStatus(404)
|
||||
|
||||
// Check user can access this audiobooks library
|
||||
if (!req.user.checkCanAccessLibrary(audiobook.libraryId)) {
|
||||
return res.sendStatus(403)
|
||||
}
|
||||
|
||||
// Temp fix for books without a full cover path
|
||||
if (audiobook.book.cover && !audiobook.book.coverFullPath) {
|
||||
var isFixed = audiobook.fixFullCoverPath()
|
||||
if (!isFixed) {
|
||||
Logger.warn(`[BookController] Failed to fix full cover path "${audiobook.book.cover}" for "${audiobook.book.title}"`)
|
||||
return res.sendStatus(404)
|
||||
}
|
||||
await this.db.updateEntity('audiobook', audiobook)
|
||||
}
|
||||
|
||||
const options = {
|
||||
format: format || (reqSupportsWebp(req) ? 'webp' : 'jpeg'),
|
||||
height: height ? parseInt(height) : null,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue