mirror of
https://github.com/matrix-org/matrix-hookshot.git
synced 2025-03-10 21:19:13 +00:00
Try to find an HTML-type link first when parsing atom feeds (#784)
Signed-off-by: Charlotte Van Petegem <charlotte@vanpetegem.me> Co-authored-by: Will Hunt <will@half-shot.uk>
This commit is contained in:
parent
3217b9eecf
commit
4351a37131
1
changelog.d/784.bugfix
Normal file
1
changelog.d/784.bugfix
Normal file
@ -0,0 +1 @@
|
||||
Feeds now tries to find an HTML-type link before falling back to the first link when parsing atom feeds
|
@ -102,7 +102,12 @@ fn parse_feed_to_js_result(feed: &Feed) -> JsRssChannel {
|
||||
.iter()
|
||||
.map(|item| FeedItem {
|
||||
title: Some(item.title().value.clone()),
|
||||
link: item.links().first().map(|f| f.href.clone()),
|
||||
link: item
|
||||
.links()
|
||||
.iter()
|
||||
.find(|l| l.mime_type.as_ref().map_or(false, |t| t == "text/html"))
|
||||
.or_else(|| item.links().first())
|
||||
.map(|f| f.href.clone()),
|
||||
id: Some(item.id.clone()),
|
||||
// No equivalent
|
||||
id_is_permalink: false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user