mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-11-08 00:54:33 +01:00
Fix:OPF parser crash when no narrators #1578
This commit is contained in:
parent
aef2c52630
commit
3df7caa838
@ -296,7 +296,7 @@ class Book {
|
||||
})
|
||||
}
|
||||
} else if (key === 'narrators') {
|
||||
if (opfMetadata.narrators && opfMetadata.narrators.length && (!this.metadata.narrators.length || opfMetadataOverrideDetails)) {
|
||||
if (opfMetadata.narrators?.length && (!this.metadata.narrators.length || opfMetadataOverrideDetails)) {
|
||||
metadataUpdatePayload.narrators = opfMetadata.narrators
|
||||
}
|
||||
} else if (key === 'series') {
|
||||
|
@ -111,7 +111,7 @@ function fetchVolumeNumber(metadataMeta) {
|
||||
|
||||
function fetchNarrators(creators, metadata) {
|
||||
const narrators = fetchCreators(creators, 'nrt')
|
||||
if (typeof metadata.meta == "undefined" || narrators.length) return narrators
|
||||
if (narrators?.length) return narrators
|
||||
try {
|
||||
const narratorsJSON = JSON.parse(fetchTagString(metadata.meta, "calibre:user_metadata:#narrators").replace(/"/g, '"'))
|
||||
return narratorsJSON["#value#"]
|
||||
@ -150,7 +150,7 @@ module.exports.parseOpfMetadataXML = async (xml) => {
|
||||
const metadataMeta = prefix ? metadata[`${prefix}:meta`] || metadata.meta : metadata.meta
|
||||
|
||||
metadata.meta = {}
|
||||
if (metadataMeta && metadataMeta.length) {
|
||||
if (metadataMeta?.length) {
|
||||
metadataMeta.forEach((meta) => {
|
||||
if (meta && meta['$'] && meta['$'].name) {
|
||||
metadata.meta[meta['$'].name] = [meta['$'].content || '']
|
||||
|
Loading…
Reference in New Issue
Block a user