Headline links do not get parsed in some ATOM feeds

slimandslam - March 23, 2007 - 07:02
Project:Drupal
Version:7.x-dev
Component:aggregator.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:patch (code needs work)
Description

Use any Blogger ATOM feed. Here's a random one:

http://www.librarything.com/thingology/atom.xml

Add it to Aggregator. Create a block. Roll your mouse over the headlines in the block.
You'll see that the links are all the same. That's a bug in Aggregator. The problem
happens because when aggregator parses the "CONTENT" tag, it sets $element=''
That happens in the parser routine aggregator_element_end();

The fix:

1) Remove this line from the function aggregator_element_end()
case 'CONTENT':

2) In the function aggregator_element_start() remove this line:
case 'CONTENT':
and then add it back in near the bottom of the switch statement like this:
case 'CONTENT':
if ($element != 'ITEM') {
$element = $name;
}
break;

#1

slimandslam - March 23, 2007 - 07:11

Note: I have verified this bug in Drupal 4.7.6 and 5.1

#2

budda - March 23, 2007 - 09:53
Project:Aggregator Node» Drupal
Version:HEAD» 6.x-dev
Component:Code» aggregator.module

Wrong project?

#3

Boris Mann - April 6, 2007 - 23:23
Version:6.x-dev» 5.x-dev
Status:active» patch (code needs review)

This seems to have correctly identified the issue and fix for Atom feeds (aka Blogspot in many cases). Setting to 5.x as bug fix, need a patch rolled.

#4

Zen - April 13, 2007 - 13:29
Status:patch (code needs review)» patch (code needs work)

Please provide your solution in patch form, preferably against HEAD / 6-dev.

#5

csevb10 - April 13, 2007 - 15:44
Version:5.x-dev» 6.x-dev
Assigned to:Anonymous» csevb10
Status:patch (code needs work)» patch (code needs review)

Patched against HEAD / 6-dev according to the post by slimandslam

AttachmentSize
aggregator_atom.patch859 bytes

#6

catch - October 29, 2007 - 12:11

This still applies with offset. Small fix. I don't use aggregator.module so could do with review by someone who does.

#7

mustafau - August 15, 2008 - 12:05
Title:Headline Links do not get parsed in some ATOM feeds» Headline links do not get parsed in some ATOM feeds
Version:6.x-dev» 7.x-dev
Assigned to:csevb10» Anonymous
Status:patch (code needs review)» patch (reviewed & tested by the community)

Re-rolling.

Aggregator tests are passing. Also did not break tests I have written for #72915: Move feed parser to includes/feed.inc

AttachmentSize
aggregator_atom_fix.patch912 bytes

#8

Dries - August 16, 2008 - 07:35
Status:patch (reviewed & tested by the community)» patch (code needs work)

Would be great to have a test case for Atom feeds that illustrate this bug. With a test case, this patch will go in with the blink of an eye.

#9

mustafau - August 16, 2008 - 14:31
Status:patch (code needs work)» patch (reviewed & tested by the community)

A test case is attached.

I have created more tests than this however some of my tests are failing. I will open another issue after this issue is fixed.

AttachmentSize
feed_parser_atom_test.patch7.79 KB

#10

Dries - August 17, 2008 - 10:01
Status:patch (reviewed & tested by the community)» patch (code needs work)

I think this looks good, but I'd prefer to trim down the feed and to make it link to example.com, etc. I'm not sure it is a good idea to include that feed "as is". Let's clean it up a little so it is actually a fake feed but with the same features. Almost there ...

#11

mustafau - August 17, 2008 - 17:28

Sample feed links to example.com now.

AttachmentSize
test-feed-parser-atom-11.patch5.13 KB
 
 

Drupal is a registered trademark of Dries Buytaert.