Fix the things I broke in b74dbb74bb

Someone really needs to restrict my access to anything that involves
transistors when I am sleep deprived.
This commit is contained in:
Jordan Petridis 2018-04-10 07:01:55 +03:00
parent b74dbb74bb
commit 5cd0a3c451
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
2 changed files with 5 additions and 4 deletions

View File

@ -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 `<a>` tags
.link_rel(None)
.clean(chan.description().trim())
.clean(s.trim())
.to_string();
Some(sanitized_html)
});
NewEpisodeBuilder::default()

View File

@ -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()));