From 05a097d09e22a630d0bb77f00018bc49cf7129bd Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 3 Dec 2009 09:25:01 +0000 Subject: [PATCH] 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 --- chrome/content/zotero/xpcom/storage/webdav.js | 12 ++++++++++-- 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 index 7a64e149e4..676dd12994 100644 --- 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 index 6ae71a5bbd..e552d36e67 100644 --- 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));