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
This commit is contained in:
Dan Stillman 2009-12-03 09:25:01 +00:00
parent 7984e77524
commit 05a097d09e
2 changed files with 20 additions and 4 deletions

View file

@ -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);

View file

@ -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));