diff --git a/server/utils/parseOpfMetadata.js b/server/utils/parseOpfMetadata.js index 74df3e6a..f48603de 100644 --- a/server/utils/parseOpfMetadata.js +++ b/server/utils/parseOpfMetadata.js @@ -1,4 +1,5 @@ const { xmlToJSON } = require('./index') +const { stripHtml } = require("string-strip-html") function parseCreators(metadata) { if (!metadata['dc:creator']) return null @@ -56,7 +57,7 @@ function fetchDescription(metadata) { // check if description is HTML or plain text. only plain text allowed // calibre stores < and > as < and > description = description.replace(/</g, '<').replace(/>/g, '>') - if (description.match(/|<\/?\s*[a-z-][^>]*\s*>|(\&(?:[\w\d]+|#\d+|#x[a-f\d]+);)/)) return null + if (description.match(/|<\/?\s*[a-z-][^>]*\s*>|(\&(?:[\w\d]+|#\d+|#x[a-f\d]+);)/)) return stripHtml(description).result return description }