diff --git a/server/utils/podcastUtils.js b/server/utils/podcastUtils.js index ac96c8d0..627e24b2 100644 --- a/server/utils/podcastUtils.js +++ b/server/utils/podcastUtils.js @@ -59,8 +59,8 @@ function extractPodcastMetadata(channel) { if (channel['description']) { const rawDescription = extractFirstArrayItem(channel, 'description') || '' - metadata.description = htmlSanitizer.sanitize(rawDescription) - metadata.descriptionPlain = htmlSanitizer.stripAllTags(rawDescription) + metadata.description = htmlSanitizer.sanitize(rawDescription.trim()) + metadata.descriptionPlain = htmlSanitizer.stripAllTags(rawDescription.trim()) } const arrayFields = ['title', 'language', 'itunes:explicit', 'itunes:author', 'pubDate', 'link', 'itunes:type'] @@ -103,8 +103,8 @@ function extractEpisodeData(item) { // Supposed to be the plaintext description but not always followed if (item['description']) { const rawDescription = extractFirstArrayItem(item, 'description') || '' - if (!episode.description) episode.description = htmlSanitizer.sanitize(rawDescription) - episode.descriptionPlain = htmlSanitizer.stripAllTags(rawDescription) + if (!episode.description) episode.description = htmlSanitizer.sanitize(rawDescription.trim()) + episode.descriptionPlain = htmlSanitizer.stripAllTags(rawDescription.trim()) } if (item['pubDate']) {