This project is read-only.
2
Vote

Feed item creation needs more error handling

description

This may just be a Feedburner issue or could be beyond that. When I first tried to add my Feedburner feeds and show them in the widget, nothing was showing up. I ended up getting the source and debugging and here are some things I found. This is in Contrib.FeedsAggregator.Services.FeedsService - ParseRSSItems.

if the DateTime.TryParse on the pubdate fails, the date isn't validated. This causes the entry to fail when persisted to the database. I was seeing some dates come back as the 1/1/0001 date. I added an if statement around collection add and that seemed to fix it
if(publishedDateTime > DateTime.MinValue)

Another thing I noticed is that for some blog feeds, the entire post is put into the description field. At minimum, there should be a check to make sure this doesn't overflow the Description field in the database. Something like:
if (description.Length > 4000)
{
description = description.Substring(0, 3950) + " ...";
}

Personally I think this is still way too longer for intended purpose. Maybe allow the user to set the maximum description length they want to show.

One more thing. After the sort, the Take(count) line doesn't sort correctly if you want to see newer entries first. Maybe this should be configurable as well, but I think most people want to see the last x entries, not the first x entries the feed happens to return. I added .OrderByDescending(t => t.PublishedDateTime) to both return lines and that gave me the results I was expecting.

comments