mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-08 00:08:14 +01:00
Fix:Crash when author is set without a name #1934
This commit is contained in:
parent
24b9ac6a68
commit
c2793fe29b
@ -165,7 +165,7 @@ class AuthorController {
|
|||||||
var q = (req.query.q || '').toLowerCase()
|
var q = (req.query.q || '').toLowerCase()
|
||||||
if (!q) return res.json([])
|
if (!q) return res.json([])
|
||||||
var limit = (req.query.limit && !isNaN(req.query.limit)) ? Number(req.query.limit) : 25
|
var limit = (req.query.limit && !isNaN(req.query.limit)) ? Number(req.query.limit) : 25
|
||||||
var authors = Database.authors.filter(au => au.name.toLowerCase().includes(q))
|
var authors = Database.authors.filter(au => au.name?.toLowerCase().includes(q))
|
||||||
authors = authors.slice(0, limit)
|
authors = authors.slice(0, limit)
|
||||||
res.json({
|
res.json({
|
||||||
results: authors
|
results: authors
|
||||||
|
@ -57,7 +57,10 @@ class Author {
|
|||||||
|
|
||||||
setData(data, libraryId) {
|
setData(data, libraryId) {
|
||||||
this.id = uuidv4()
|
this.id = uuidv4()
|
||||||
this.name = data.name
|
if (!data.name) {
|
||||||
|
Logger.error(`[Author] setData: Setting author data without a name`, data)
|
||||||
|
}
|
||||||
|
this.name = data.name || ''
|
||||||
this.description = data.description || null
|
this.description = data.description || null
|
||||||
this.asin = data.asin || null
|
this.asin = data.asin || null
|
||||||
this.imagePath = data.imagePath || null
|
this.imagePath = data.imagePath || null
|
||||||
|
Loading…
Reference in New Issue
Block a user