summaryrefslogtreecommitdiff
path: root/modules/aggregator
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2012-10-12 13:10:21 -0700
committerwebchick <webchick@24967.no-reply.drupal.org>2012-10-12 13:10:21 -0700
commit8615b92be64780ad650b28fdec5dfb6c4c54f467 (patch)
tree14941c2d12a1a0faf443035cc987e1432a649afd /modules/aggregator
parent2deea29304e984b576509b7d9ec9d388761aba30 (diff)
downloadbrdo-8615b92be64780ad650b28fdec5dfb6c4c54f467.tar.gz
brdo-8615b92be64780ad650b28fdec5dfb6c4c54f467.tar.bz2
Issue #1622974 by xjm, iflista, brianV: Fixed Aggregator fails to parse author entries longer than 255 characters.
Diffstat (limited to 'modules/aggregator')
-rw-r--r--modules/aggregator/aggregator.processor.inc3
-rw-r--r--modules/aggregator/aggregator.test15
-rw-r--r--modules/aggregator/tests/aggregator_test_rss091.xml11
3 files changed, 25 insertions, 4 deletions
diff --git a/modules/aggregator/aggregator.processor.inc b/modules/aggregator/aggregator.processor.inc
index 7fa86a9ad..3f1319c8c 100644
--- a/modules/aggregator/aggregator.processor.inc
+++ b/modules/aggregator/aggregator.processor.inc
@@ -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']));
}
}
diff --git a/modules/aggregator/aggregator.test b/modules/aggregator/aggregator.test
index 24205fcca..d74b5416f 100644
--- a/modules/aggregator/aggregator.test
+++ b/modules/aggregator/aggregator.test
@@ -583,9 +583,9 @@ class RemoveFeedItemTestCase extends AggregatorTestCase {
// 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);
}
@@ -943,6 +943,15 @@ class FeedParserTestCase extends AggregatorTestCase {
$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');
}
/**
diff --git a/modules/aggregator/tests/aggregator_test_rss091.xml b/modules/aggregator/tests/aggregator_test_rss091.xml
index f39a2732c..29440227f 100644
--- a/modules/aggregator/tests/aggregator_test_rss091.xml
+++ b/modules/aggregator/tests/aggregator_test_rss091.xml
@@ -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>