Fix:Crash when searching for cover without an author #2174

This commit is contained in:
advplyr 2023-10-02 17:09:12 -05:00
parent 20a1d40d99
commit a3a8937ba3
3 changed files with 2 additions and 3 deletions

View File

@ -259,7 +259,6 @@ class LibraryItemController {
// Check if library item media has a cover path // Check if library item media has a cover path
if (!libraryItem.media.coverPath || !await fs.pathExists(libraryItem.media.coverPath)) { if (!libraryItem.media.coverPath || !await fs.pathExists(libraryItem.media.coverPath)) {
Logger.debug(`[LibraryItemController] getCover: Library item "${req.params.id}" has no cover path`)
return res.sendStatus(404) return res.sendStatus(404)
} }

View File

@ -26,7 +26,7 @@ class SearchController {
let results = null let results = null
if (podcast) results = await PodcastFinder.findCovers(query.title) if (podcast) results = await PodcastFinder.findCovers(query.title)
else results = await BookFinder.findCovers(query.provider || 'google', query.title, query.author || null) else results = await BookFinder.findCovers(query.provider || 'google', query.title, query.author || '')
res.json({ res.json({
results results
}) })

View File

@ -234,7 +234,7 @@ class BookFinder {
if (!books.length && maxFuzzySearches > 0) { if (!books.length && maxFuzzySearches > 0) {
// normalize title and author // normalize title and author
title = title.trim().toLowerCase() title = title.trim().toLowerCase()
author = author.trim().toLowerCase() author = author?.trim().toLowerCase() || ''
// Now run up to maxFuzzySearches fuzzy searches // Now run up to maxFuzzySearches fuzzy searches
let candidates = new Set() let candidates = new Set()