Commit 16e74de4 authored by webchick's avatar webchick

Issue #1622974 by xjm: Fixed Aggregator fails to parse author entries longer than 255 characters.

parent 5b167ad1
......@@ -38,8 +38,9 @@ function aggregator_aggregator_process($feed) {
$item['timestamp'] = isset($entry->timestamp) ? $entry->timestamp : REQUEST_TIME;
}
// Make sure the item title fits in 255 varchar column.
// Make sure the item title and author fit in the 255 varchar column.
$item['title'] = truncate_utf8($item['title'], 255, TRUE, TRUE);
$item['author'] = truncate_utf8($item['author'], 255, TRUE, TRUE);
aggregator_save_item(array('iid' => (isset($entry->iid) ? $entry->iid : ''), 'fid' => $feed->fid, 'timestamp' => $item['timestamp'], 'title' => $item['title'], 'link' => $item['link'], 'author' => $item['author'], 'description' => $item['description'], 'guid' => $item['guid']));
}
}
......
......@@ -38,6 +38,15 @@ function testRSS091Sample() {
$this->assertText('First example feed item title');
$this->assertLinkByHref('http://example.com/example-turns-one');
$this->assertText('First example feed item description.');
// Several additional items that include elements over 255 characters.
$this->assertRaw("Second example feed item title.");
$this->assertText('Long link feed item title');
$this->assertText('Long link feed item description');
$this->assertLinkByHref('http://example.com/tomorrow/and/tomorrow/and/tomorrow/creeps/in/this/petty/pace/from/day/to/day/to/the/last/syllable/of/recorded/time/and/all/our/yesterdays/have/lighted/fools/the/way/to/dusty/death/out/out/brief/candle/life/is/but/a/walking/shadow/a/poor/player/that/struts/and/frets/his/hour/upon/the/stage/and/is/heard/no/more/it/is/a/tale/told/by/an/idiot/full/of/sound/and/fury/signifying/nothing');
$this->assertText('Long author feed item title');
$this->assertText('Long author feed item description');
$this->assertLinkByHref('http://example.com/long/author');
}
/**
......
......@@ -36,9 +36,9 @@ function testRemoveFeedItem() {
// Update and remove items two times in a row to make sure that removal
// resets all 'modified' information (modified, etag, hash) and allows for
// immediate update.
$this->updateAndRemove($feed, 2);
$this->updateAndRemove($feed, 2);
$this->updateAndRemove($feed, 2);
$this->updateAndRemove($feed, 4);
$this->updateAndRemove($feed, 4);
$this->updateAndRemove($feed, 4);
// Delete feed.
$this->deleteFeed($feed);
}
......
......@@ -26,5 +26,16 @@
<link>http://example.com/example-turns-two</link>
<description>Second example feed item description.</description>
</item>
<item>
<title>Long link feed item title.</title>
<link>http://example.com/tomorrow/and/tomorrow/and/tomorrow/creeps/in/this/petty/pace/from/day/to/day/to/the/last/syllable/of/recorded/time/and/all/our/yesterdays/have/lighted/fools/the/way/to/dusty/death/out/out/brief/candle/life/is/but/a/walking/shadow/a/poor/player/that/struts/and/frets/his/hour/upon/the/stage/and/is/heard/no/more/it/is/a/tale/told/by/an/idiot/full/of/sound/and/fury/signifying/nothing</link>
<description>Long link feed item description.</description>
</item>
<item>
<title>Long author feed item title.</title>
<link>http://example.com/long/author</link>
<author>I wanted to get out and walk eastward toward the park through the soft twilight, but each time I tried to go I became entangled in some wild, strident argument which pulled me back, as if with ropes, into my chair. Yet high over the city our line of yellow windows must have contributed their share of human secrecy to the casual watcher in the darkening streets, and I was him too, looking up and wondering. I was within and without, simultaneously enchanted and repelled by the inexhaustible variety of life.</author>
<description>Long author feed item description.</description>
</item>
</channel>
</rss>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment