commit 05a097d09e22a630d0bb77f00018bc49cf7129bd parent 7984e77524366df94e2670045f4c74e10721d1e4 Author: Dan Stillman <dstillman@zotero.org> Date: Thu, 3 Dec 2009 09:25:01 +0000 Don't trigger file conflict if saved file timestamp is off exactly one hour from saved timestamp I'd prefer to fix this properly, but I'm not sure exactly what's causing it on various platforms, and the odds of a file being edited exactly one hour to the second after the saved timestamp are fairly slim Diffstat:
| M | chrome/content/zotero/xpcom/storage/webdav.js | | | 12 | ++++++++++-- |
| M | chrome/content/zotero/xpcom/storage/zfs.js | | | 12 | ++++++++++-- |
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/chrome/content/zotero/xpcom/storage/webdav.js b/chrome/content/zotero/xpcom/storage/webdav.js @@ -423,8 +423,16 @@ Zotero.Sync.Storage.Session.WebDAV.prototype._processUploadFile = function (data // Local file time var fmtime = item.attachmentModificationTime; - if (fmtime == mtime) { - Zotero.debug("File mod time matches remote file -- skipping upload"); + // Allow timestamp to be exactly one hour off to get around + // time zone issues -- there may be a proper way to fix this + if (fmtime == mtime || Math.abs(fmtime - mtime) == 3600) { + if (fmtime == mtime) { + Zotero.debug("File mod time matches remote file -- skipping upload"); + } + else { + Zotero.debug("File mod time (" + fmtime + ") is exactly one hour off remote file (" + mtime + ") " + + "-- assuming time zone issue and skipping upload"); + } Zotero.DB.beginTransaction(); var syncState = Zotero.Sync.Storage.getSyncState(item.id); diff --git a/chrome/content/zotero/xpcom/storage/zfs.js b/chrome/content/zotero/xpcom/storage/zfs.js @@ -315,8 +315,16 @@ Zotero.Sync.Storage.Session.ZFS.prototype._processUploadFile = function (data) { // Local file time var fmtime = item.attachmentModificationTime; - if (fmtime == mtime) { - Zotero.debug("File mod time matches remote file -- skipping upload"); + // Allow timestamp to be exactly one hour off to get around + // time zone issues -- there may be a proper way to fix this + if (fmtime == mtime || Math.abs(fmtime - mtime) == 3600) { + if (fmtime == mtime) { + Zotero.debug("File mod time matches remote file -- skipping upload"); + } + else { + Zotero.debug("File mod time (" + fmtime + ") is exactly one hour off remote file (" + mtime + ") " + + "-- assuming time zone issue and skipping upload"); + } Zotero.debug(Zotero.Sync.Storage.getSyncedModificationTime(item.id));