Closed Bug 354345 Opened 18 years ago Closed 18 years ago

Set isStoredWithId for RSS 2.0 feed items

Categories

(MailNews Core :: Feed Reader, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jwkbugzilla, Assigned: jwkbugzilla)

References

()

Details

(Keywords: fixed1.8.1.1)

Attachments

(1 file, 2 obsolete files)

For some reason item.isStoredWithId is only set for IETF Atom feeds at the moment, for all other feeds the items are stored by their URL. This sometimes causes duplicated entries, e.g. blogs.msdn.com (most prominently the IEBlog) changed the URLs regularly in the past - they alternated between the server's name and its IP. The GUID stayed the same of course.
Attached patch Proposed patch (obsolete) — Splinter Review
Assignee: mscott → trev
Status: NEW → ASSIGNED
Attachment #240170 - Flags: review?
Attachment #240170 - Flags: review? → review?(bienvenu)
Comment on attachment 240170 [details] [diff] [review]
Proposed patch

Scott, should Robert review this? I really have no idea if this is the right thing to do or not...
Attachment #240170 - Flags: superreview?(mscott)
Attachment #240170 - Flags: review?(bienvenu)
Attachment #240170 - Flags: review?
Comment on attachment 240170 [details] [diff] [review]
Proposed patch

Let's get Robert to review this change and David can sr.
Attachment #240170 - Flags: review? → review?(sayrer)
I'll take a look at this today. I didn't set this for RSS2 because I was concerned about existing items. We were starting fresh with the Atom stuff, so dupes weren't a concern.
Note: in bug 258465, the duplicates appear even if the URL hasn't changed.
Ok, that's some explanation at least. We could use the URL as fallback if we don't find the GUID. Would add something like this to the isStored method:

if (!downloaded && itemURI != this.mURL)
{
  itemResource = rdf.GetResource(this.mURL);
  downloaded = ds.GetTarget(itemResource, FZ_STORED, true);
}

Would this be acceptable? This code could them be removed in some later version of Thunderbird.
Rimas, this bug is only about solving one part of bug 258465. There are probably more issues causing duplicated entries but they are not subject of this bug.
(In reply to comment #6)
> Ok, that's some explanation at least. 

Well, IIRC, the Atom code went in pretty late before TB1.5. Changing RSS2 wouldn't have been an option at that point.

> Would this be acceptable? This code could them be removed in some later version
> of Thunderbird.
> 

Yeah, this works. We'll need a new patch with a comment explaining why this check exists. Thanks for digging into this.
http://adblockplus.org/trash/test_feed.pl is testcase - this feed will change URL randomly generating new items on average every second time you download it.
Attached patch Patch with fallback (obsolete) — Splinter Review
Added fallback code to the patch - if we can't find an item by its ID we'll try the URL now. Tested: testcase stops generating duplicate items, and IEBlog items aren't re-added after the update.
Attachment #240170 - Attachment is obsolete: true
Attachment #240183 - Flags: superreview?
Attachment #240183 - Flags: review?(sayrer)
Attachment #240170 - Flags: superreview?(mscott)
Attachment #240170 - Flags: review?(sayrer)
Attachment #240183 - Flags: superreview? → superreview?(mscott)
Comment on attachment 240183 [details] [diff] [review]
Patch with fallback

r=sayrer
Attachment #240183 - Flags: review?(sayrer) → review+
(In reply to comment #9)
> http://adblockplus.org/trash/test_feed.pl is testcase - this feed will change
> URL randomly generating new items on average every second time you download it.
> 

@wp - thanks...

testcase caught bug [url=https://bugzilla.mozilla.org/show_bug.cgi?id=297569]297569[/url] when subscribing.

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20060925 Thunderbird/2.0b1pre ID:2006092503
Attachment #240183 - Flags: superreview?(mscott)
Attachment #240183 - Flags: superreview+
Attachment #240183 - Flags: approval-thunderbird2+
Something is wrong with that patch. Restored my feeditems.rdf from before applying this patch - the first download of an RSS 2.0 feed is fine but the second re-adds all the items. feeditems.rdf doesn't contain the items stored by URL any more then, trying to find out why they were removed...
Found the issue - we need to add the same fallback check to item.markValid(). The way it was markValid() would mark the RDF resource built from ID instead of URL for old items - as a result we get one RDF node that is "valid" but not stored and another that is stored but not valid. The latter gets removed then.

Requesting review again, just in case. This time everything really seems to work.
Attachment #240183 - Attachment is obsolete: true
Attachment #241361 - Flags: superreview?(mscott)
Attachment #241361 - Flags: review?(sayrer)
Attachment #240183 - Flags: approval-thunderbird2+ → approval-thunderbird2-
Attachment #241361 - Flags: superreview?(mscott) → superreview+
Comment on attachment 241361 [details] [diff] [review]
Patch with fallback 2

good catch, sorry I missed that.
Attachment #241361 - Flags: review?(sayrer) → review+
Comment on attachment 241361 [details] [diff] [review]
Patch with fallback 2

With the revised Thunderbird 2.0 roadmap - any chance for this to get in?
Attachment #241361 - Flags: approval-thunderbird2?
Comment on attachment 241361 [details] [diff] [review]
Patch with fallback 2

This can land on the branch and the trunk. Thanks for the patch!
Attachment #241361 - Flags: approval-thunderbird2? → approval-thunderbird2+
landed on trunk.

Checking in feed-parser.js;
/cvsroot/mozilla/mail/extensions/newsblog/content/feed-parser.js,v  <--  feed-parser.js
new revision: 1.19; previous revision: 1.18
done
Checking in FeedItem.js;
/cvsroot/mozilla/mail/extensions/newsblog/content/FeedItem.js,v  <--  FeedItem.js
new revision: 1.39; previous revision: 1.38
done
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
and I just landed it for thunderbird 2. thanks for the patch!
Keywords: fixed1.8.1.1
Depends on: 363154
Wladimir, could this patch have caused Bug 363154 ? 
No longer depends on: 363154
Component: RSS → Feed Reader
Product: Thunderbird → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: