feedindicator / Feedindicator

RSS feed updates in Ubuntu, as a lightweight indicator
38 stars 12 forks source link

[PATCH] Correctly parse feeds with multiple links (e.g. http://weblog.rubyonrails.org/feed/atom.xml) #49

Closed nicolas-raoul closed 9 years ago

nicolas-raoul commented 9 years ago

Originally reported on Google Code with ID 39

Howdy-

I noticed that on Ubuntu 11.10 feedindicator v20110603 fails to load the Ruby on Rails
weblog's new atom feed (http://weblog.rubyonrails.org/feed/atom.xml).  

I tracked the problem down to multiple links in their feed, i.e. <link type="application/atom+xml"
href="http://weblog.rubyonrails.org/feed/" rel="self"/> and <link type="text" href="http://weblog.rubyonrails.org/"
rel="alternate"/>.  When feedparser parses this feed it does not create a feed.link
property, so feedindicator throws an exception on line 809 when setting feedinfo['feeddata']:

feedinfo['feeddata'] = {'title': rssfeed.feed.title, 'link': rssfeed.feed.link, 'img':
feedimg}
feedinfo['success'] = True

The attached patch fixes this by first checking if rssfeed.feed.link exists; if it
does then use it as is done currently, but if it doesn't then iterate through rssfeed.feed.links
looking for the one with rel="alternate".  With this patch feedindicator correctly
parses http://weblog.rubyonrails.org/feed/atom.xml.

Thanks in advance!

Best,
Kent

Reported by sl4mmy on 2012-06-27 20:58:15


nicolas-raoul commented 9 years ago
Hi Kent!

Thanks for this great patch!
I applied it to the source and tested, it works well.

As discussed in issue 32, I moved the source to Github, so feel free to fork there
for your next contributions (paches are still OK of course): https://github.com/nicolas-raoul/Feedindicator

Cheers!
Nicolas Raoul

Reported by nicolas.raoul on 2012-07-01 02:37:36

nicolas-raoul commented 9 years ago
Fix present in version 1.04

Reported by nicolas.raoul on 2012-08-21 09:07:24