From 729080db4da0d18cf28758a9020aecd113d00b53 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 3 Apr 2013 05:22:33 -0400 Subject: [PATCH] Fix "this._deferred is null" WebDAV sync error This occurred if an attachment had only files beginning with periods. --- chrome/content/zotero/xpcom/storage/queue.js | 7 ++++++- chrome/content/zotero/xpcom/storage/webdav.js | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/storage/queue.js b/chrome/content/zotero/xpcom/storage/queue.js index 941e79e50..5b4962026 100644 --- a/chrome/content/zotero/xpcom/storage/queue.js +++ b/chrome/content/zotero/xpcom/storage/queue.js @@ -230,7 +230,12 @@ Zotero.Sync.Storage.Queue.prototype.start = function () { // The queue manager needs to know what queues were running in the // current session Zotero.Sync.Storage.QueueManager.addCurrentQueue(this); - this.advance(); + + var self = this; + setTimeout(function () { + self.advance(); + }, 0); + return this._deferred.promise; } diff --git a/chrome/content/zotero/xpcom/storage/webdav.js b/chrome/content/zotero/xpcom/storage/webdav.js index a762079bd..108a4eccc 100644 --- a/chrome/content/zotero/xpcom/storage/webdav.js +++ b/chrome/content/zotero/xpcom/storage/webdav.js @@ -957,7 +957,7 @@ Zotero.Sync.Storage.WebDAV = (function () { obj._uploadFile = function (request) { var deferred = Q.defer(); - Zotero.Sync.Storage.createUploadFile( + var created = Zotero.Sync.Storage.createUploadFile( request, function (data) { deferred.resolve( @@ -967,6 +967,9 @@ Zotero.Sync.Storage.WebDAV = (function () { ); } ); + if (!created) { + return Q(false); + } return deferred.promise; };