mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-20 02:39:38 +00:00
Normalize tags and genres in BookFinder results
This commit is contained in:
parent
c7c21cc137
commit
4fbf306308
1 changed files with 9 additions and 0 deletions
|
|
@ -595,6 +595,15 @@ class BookFinder {
|
|||
book.description = htmlSanitizer.sanitize(book.description)
|
||||
book.descriptionPlain = htmlSanitizer.stripAllTags(book.description)
|
||||
}
|
||||
if (book.tags) {
|
||||
// Some return comma-separated strings, some return arrays
|
||||
const tagsArray = Array.isArray(book.tags) ? book.tags : String(book.tags).split(',')
|
||||
book.tags = [...new Set(tagsArray.map((t) => t.trim()).filter(Boolean))]
|
||||
}
|
||||
if (book.genres) {
|
||||
const genresArray = Array.isArray(book.genres) ? book.genres : String(book.genres).split(',')
|
||||
book.genres = [...new Set(genresArray.map((g) => g.trim()).filter(Boolean))]
|
||||
}
|
||||
})
|
||||
return books
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue