Throw error on invalid 200 response to HEAD request, which you might argue shouldn't be possible

This commit is contained in:
Dan Stillman 2010-02-06 16:36:02 +00:00
parent c44b7a5c14
commit 54c0b40870

View file

@ -130,23 +130,27 @@ Zotero.Sync.Storage.Session.ZFS.prototype._getStorageFileInfo = function (item,
var info = {};
info.hash = req.getResponseHeader('ETag');
if (!info.hash) {
var msg = "Hash not found in HEAD response in " + funcName
+ " (" + Zotero.Items.getLibraryKeyHash(item) + ")";
Zotero.debug(msg, 1);
Zotero.debug(req.responseText);
Components.utils.reportError(msg);
try {
Zotero.debug(req.getAllResponseHeaders());
}
catch (e) {
Zotero.debug("Response headers unavailable");
}
self.onError();
return;
}
info.filename = req.getResponseHeader('X-Zotero-Filename');
var mtime = req.getResponseHeader('X-Zotero-Modification-Time');
info.mtime = parseInt(mtime);
info.compressed = req.getResponseHeader('X-Zotero-Compressed') == 'Yes';
Zotero.debug(info);
if (!info.hash) {
Zotero.debug('========');
Zotero.debug("Hash not found in HEAD response in " + funcName, 2);
Zotero.debug(req.status);
Zotero.debug(item.key);
Zotero.debug(req.responseText);
Zotero.debug(req.getAllResponseHeaders());
//callback(item, false);
//return;
}
callback(item, info);
});
}