Fix download retrying

Follow-up from 238a972a
This commit is contained in:
Dan Stillman 2014-06-10 03:50:41 -04:00
parent 238a972ace
commit fad6174e39
2 changed files with 6 additions and 2 deletions

View file

@ -192,7 +192,7 @@ Zotero.Sync.Storage.StreamListener.prototype = {
Zotero.debug('Request ended with status ' + status);
var cancelled = status == 0x804b0002; // NS_BINDING_ABORTED
if (!cancelled && request instanceof Components.interfaces.nsIHttpChannel) {
if (!cancelled && status == 0 && request instanceof Components.interfaces.nsIHttpChannel) {
request.QueryInterface(Components.interfaces.nsIHttpChannel);
try {
status = request.responseStatus;
@ -203,6 +203,9 @@ Zotero.Sync.Storage.StreamListener.prototype = {
}
request.QueryInterface(Components.interfaces.nsIRequest);
}
else {
status = 0;
}
if (this._data.streams) {
for each(var stream in this._data.streams) {

View file

@ -751,6 +751,8 @@ Zotero.Sync.Storage.ZFS = (function () {
throw new Error("Item '" + request.name + "' not found");
}
var self = this;
// Retrieve file info from server to store locally afterwards
return getStorageFileInfo(item, request)
.then(function (info) {
@ -869,7 +871,6 @@ Zotero.Sync.Storage.ZFS = (function () {
+ " (" + libraryKey + ") -- retrying download"
Components.utils.reportError(msg);
Zotero.debug(msg, 1);
Zotero.debug(response, 1);
if (_s3Backoff < _maxS3Backoff) {
_s3Backoff *= 2;
}