mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-24 09:49:24 +02:00
Add:HTML sanitizer lib to support html in podcasts and replace strip html lib
This commit is contained in:
parent
96232676cb
commit
c4bfa266b0
9 changed files with 1051 additions and 252 deletions
|
@ -1,5 +1,5 @@
|
|||
const { xmlToJSON } = require('./index')
|
||||
const { stripHtml } = require("string-strip-html")
|
||||
const htmlSanitizer = require('./htmlSanitizer')
|
||||
|
||||
function parseCreators(metadata) {
|
||||
if (!metadata['dc:creator']) return null
|
||||
|
@ -57,8 +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(/<!DOCTYPE html>|<\/?\s*[a-z-][^>]*\s*>|(\&(?:[\w\d]+|#\d+|#x[a-f\d]+);)/)) return stripHtml(description).result
|
||||
return description
|
||||
return htmlSanitizer.stripAllTags(description)
|
||||
}
|
||||
|
||||
function fetchGenres(metadata) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue