commit 9dad2c60482f6c9b845273cedcb585a33a1d0fa7
parent 2d0874dd6604f88c365e5319cb91bd4d3687ef6b
Author: Dan Stillman <dstillman@zotero.org>
Date: Tue, 13 Jul 2010 17:47:01 +0000
Commons:
- Use same character-stripping logic as IA when looking for RDF file
- Better handling of empty RDF files
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/chrome/content/zotero/xpcom/commons.js b/chrome/content/zotero/xpcom/commons.js
@@ -589,7 +589,9 @@ Zotero.Commons.Bucket.prototype.getItems = function (callback) {
return;
}
- var rdfURI = self.downloadURI + '/' + zip.key;
+ var rdfURI = self.downloadURI + '/'
+ // Strip characters IA strips
+ + zip.key.replace(/[^-A-Za-z0-9_.]/g, '-').replace(/-+/g, '-');
rdfURI = rdfURI.replace(/\.zip$/, "_zotero.rdf");
Zotero.Utilities.HTTP.doGet(rdfURI, function (xmlhttp) {
@@ -600,6 +602,12 @@ Zotero.Commons.Bucket.prototype.getItems = function (callback) {
return;
}
+ if (!xmlhttp.responseText) {
+ Zotero.debug("RDF file is empty at " + xmlhttp.channel.originalURI.spec);
+ process(zips);
+ return;
+ }
+
Zotero.debug(xmlhttp.responseText);
var translate = new Zotero.Translate("import");