Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FeedItem.Link returns incorrect link for AtomItems with multiple links #47

Open
acidus99 opened this issue Jul 14, 2022 · 0 comments
Open

Comments

@acidus99
Copy link

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&amp;postID=2173405820987631614&amp;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.

atom.xml.txt

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.

acidus99 added a commit to acidus99/NewsWaffle that referenced this issue Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant