Bug #258465 --> work around a nasty RDF entity replacement bug to prevent certain RSS feed items

from getting duplicated every time you check a feed for new articles.
This commit is contained in:
scott%scott-macgregor.org 2004-12-01 09:03:23 +00:00
Родитель e015f9d44c
Коммит ba1a3a0759
1 изменённых файлов: 21 добавлений и 3 удалений

Просмотреть файл

@ -173,10 +173,29 @@ FeedItem.prototype.isStored = function() {
}
var ds = getItemsDS(server);
var itemResource = rdf.GetResource(this.url || ("urn:" + this.id));
var itemURI = this.url || ("urn:" + this.id);
var itemResource = rdf.GetResource(itemURI);
var downloaded = ds.GetTarget(itemResource, FZ_STORED, true);
if (!downloaded || downloaded.QueryInterface(Components.interfaces.nsIRDFLiteral).Value == "false")
{
// HACK ALERT: before we give up, try to work around an entity escaping bug in RDF
// See Bug #258465 for more details
itemURI = itemURI.replace(/&lt;/g, '<');
itemURI = itemURI.replace(/&gt;/g, '>');
itemURI = itemURI.replace(/&amp;/g, '&');
itemURI = itemURI.replace(/&quot;/g, '"');
debug('Failed to find item, trying entity replacement version: ' + itemURI);
itemResource = rdf.GetResource(itemURI);
downloaded = ds.GetTarget(itemResource, FZ_STORED, true);
if (downloaded)
{
debug(this.identity + " not stored");
return true;
}
debug(this.identity + " not stored");
return false;
}
@ -219,10 +238,9 @@ FeedItem.prototype.markStored = function() {
currentValue = ds.GetTarget(resource, FZ_STORED, true);
ds.Change(resource, FZ_STORED, currentValue, RDF_LITERAL_TRUE);
}
else {
else
ds.Assert(resource, FZ_STORED, RDF_LITERAL_TRUE, true);
}
}
FeedItem.prototype.download = function() {
this.request = new XMLHttpRequest();