FeedItem.Link returns incorrect link for AtomItems with multiple links
acidus99 opened this issue · 0 comments
FeedItem.Link can return the incorrect link for Atom feeds where multiple link elements exist for an <entry>
.
In the Atom feed below, each <entry>
contains multiple <link>
tags each points at different things such as a feed for comments on the news item, the next news item, etc. It looks like this:
<link rel="replies" type="application/atom+xml" href="https://www.columbiaspy.com/feeds/2173405820987631614/comments/default" title="Post Comments"/>
<link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8146091995480420252&postID=2173405820987631614&isPopup=true" title="0 Comments"/>
<link rel="edit" type="application/atom+xml" href="https://www.blogger.com/feeds/8146091995480420252/posts/default/2173405820987631614"/>
<link rel="self" type="application/atom+xml" href="https://www.blogger.com/feeds/8146091995480420252/posts/default/2173405820987631614"/>
<link rel="alternate" type="text/html" href="https://www.columbiaspy.com/2022/07/driving-for-drama-benefit-car-show.html" title="DRIVING FOR DRAMA BENEFIT CAR SHOW"/>
FeedItem.Link is set by the BaseFeedItem, which simply grabs the first <link>
tag and uses that, which is incorrect. The <link rel="alternate" type="text/html">
tag should be used instead.
I am happy to submit a fix, but it would involve a slight design change. I suggest that BaseFeedItem
use abstract properties for Title
and Link
. That way the individual classes like AtomFeedItem
or Rss10FeedItem
can implement their own logic to return the appropriate value for those. In this case, AtomFeedItem
would use Linq to find the appropriate <link rel="alternate" type="text/html">
link tag.