diff --git a/chrome/content/zotero/xpcom/storage/webdav.js b/chrome/content/zotero/xpcom/storage/webdav.js index 8aebd403eb..dc9843db5a 100644 --- a/chrome/content/zotero/xpcom/storage/webdav.js +++ b/chrome/content/zotero/xpcom/storage/webdav.js @@ -853,15 +853,25 @@ Zotero.Sync.Storage.WebDAV = (function () { return false; } + var file = item.getFile(); + if (!mdate) { Zotero.debug("Remote file not found for item " + Zotero.Items.getLibraryKeyHash(item)); + // Reset sync state if a remotely missing file exists locally. + // I'm not sure how this can happen, but otherwise it results in + // a file marked as TO_DOWNLOAD never being uploaded. + if (file && file.exists()) { + Zotero.Sync.Storage.setSyncState(item.id, Zotero.Sync.Storage.SYNC_STATE_TO_UPLOAD); + return { + localChanges: true + }; + } return false; } var syncModTime = mdate.getTime(); // Skip download if local file exists and matches mod time - var file = item.getFile(); if (file && file.exists() && syncModTime == file.lastModifiedTime) { Zotero.debug("File mod time matches remote file -- skipping download"); diff --git a/chrome/content/zotero/xpcom/storage/zfs.js b/chrome/content/zotero/xpcom/storage/zfs.js index 2638e99b4c..97c7ea0882 100644 --- a/chrome/content/zotero/xpcom/storage/zfs.js +++ b/chrome/content/zotero/xpcom/storage/zfs.js @@ -762,15 +762,25 @@ Zotero.Sync.Storage.ZFS = (function () { return false; } + var file = item.getFile(); + if (!info) { Zotero.debug("Remote file not found for item " + item.libraryID + "/" + item.key); + // Reset sync state if a remotely missing file exists locally. + // I'm not sure how this can happen, but otherwise it results in + // a file marked as TO_DOWNLOAD never being uploaded. + if (file && file.exists()) { + Zotero.Sync.Storage.setSyncState(item.id, Zotero.Sync.Storage.SYNC_STATE_TO_UPLOAD); + return { + localChanges: true + }; + } return false; } var syncModTime = info.mtime; var syncHash = info.hash; - var file = item.getFile(); // Skip download if local file exists and matches mod time if (file && file.exists()) { if (syncModTime == file.lastModifiedTime) {