diff --git a/chrome/content/zotero/xpcom/storage/webdav.js b/chrome/content/zotero/xpcom/storage/webdav.js index 710fbc0e1..ad5f186f9 100644 --- a/chrome/content/zotero/xpcom/storage/webdav.js +++ b/chrome/content/zotero/xpcom/storage/webdav.js @@ -326,7 +326,18 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.downloadFile = function (request) { request.onProgress(a, b, c) }, onStop: function (request, status, response, data) { - if (status != 200) { + if (status == 404) { + var msg = "Remote ZIP file not found for item " + item.key; + Zotero.debug(msg, 2); + Components.utils.reportError(msg); + + // Delete the orphaned prop file + self._deleteStorageFiles([item.key + ".prop"], null, self); + + data.request.finish(); + return; + } + else if (status != 200) { self.onError("Unexpected status code " + status + " for request " + data.request.name + " in Zotero.Sync.Storage.Session.WebDAV.downloadFile()"); return; @@ -512,6 +523,11 @@ Zotero.Sync.Storage.Session.WebDAV.prototype._onUploadComplete = function (httpR case 204: break; + case 403: + this.onError("File upload failed. Please verify your WebDAV server " + + "from the Sync pane of the Zotero preferences."); + return; + default: this.onError("Unexpected file upload status " + status + " in Zotero.Sync.Storage._onUploadComplete()"); @@ -1312,7 +1328,7 @@ Zotero.Sync.Storage.Session.WebDAV.prototype._getPropertyURIFromItemURI = functi * 'deleted', 'missing', and 'error', * each containing filenames */ -Zotero.Sync.Storage.Session.WebDAV.prototype._deleteStorageFiles = function (files, callback) { +Zotero.Sync.Storage.Session.WebDAV.prototype._deleteStorageFiles = function (files, callback, session) { var results = { deleted: [], missing: [], @@ -1326,14 +1342,18 @@ Zotero.Sync.Storage.Session.WebDAV.prototype._deleteStorageFiles = function (fil return; } + var self = session ? session : this; + for (var i=0; i