mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-09-10 17:58:02 +02:00
Normalize tags and genres in BookFinder results
This commit is contained in:
parent
c7c21cc137
commit
4fbf306308
@ -595,6 +595,15 @@ class BookFinder {
|
|||||||
book.description = htmlSanitizer.sanitize(book.description)
|
book.description = htmlSanitizer.sanitize(book.description)
|
||||||
book.descriptionPlain = htmlSanitizer.stripAllTags(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
|
return books
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user