diff --git a/hammond-data/src/models/new_episode.rs b/hammond-data/src/models/new_episode.rs index 9df4229..d456ef1 100644 --- a/hammond-data/src/models/new_episode.rs +++ b/hammond-data/src/models/new_episode.rs @@ -234,12 +234,13 @@ impl NewEpisodeMinimal { // TODO: TryInto is stabilizing in rustc v1.26! pub(crate) fn into_new_episode(self, item: &rss::Item) -> NewEpisode { let length = item.enclosure().and_then(|x| x.length().parse().ok()); - let description = item.description().map(|s| { - ammonia::Builder::new() + let description = item.description().and_then(|s| { + let sanitized_html = ammonia::Builder::new() // Remove `rel` attributes from `` tags .link_rel(None) - .clean(chan.description().trim()) + .clean(s.trim()) .to_string(); + Some(sanitized_html) }); NewEpisodeBuilder::default() diff --git a/hammond-data/src/models/new_podcast.rs b/hammond-data/src/models/new_podcast.rs index 38f31b7..e370fef 100644 --- a/hammond-data/src/models/new_podcast.rs +++ b/hammond-data/src/models/new_podcast.rs @@ -98,7 +98,7 @@ impl NewPodcast { // Try to get the itunes img first let itunes_img = chan.itunes_ext() - .and_then(|s| s.image().trim()) + .and_then(|s| s.image().map(|url| url.trim())) .map(|s| s.to_owned()); // If itunes is None, try to get the channel.image from the rss spec let image_uri = itunes_img.or_else(|| chan.image().map(|s| s.url().trim().to_owned()));