From 5be1b75b2b8d97451961eb3b44f76367c836dc13 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 16 Sep 2009 03:37:14 +0000 Subject: [PATCH] Fix for "Invalid integer value 'Not found' [QUERY: REPLACE INTO version VALUES ('storage_zfs', ?)]" --- chrome/content/zotero/xpcom/storage/webdav.js | 13 ++++++++---- chrome/content/zotero/xpcom/storage/zfs.js | 21 +++++++++++++++---- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/chrome/content/zotero/xpcom/storage/webdav.js b/chrome/content/zotero/xpcom/storage/webdav.js index 1dfcf6fe99..9b987c3706 100644 --- a/chrome/content/zotero/xpcom/storage/webdav.js +++ b/chrome/content/zotero/xpcom/storage/webdav.js @@ -591,10 +591,15 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.getLastSyncTime = function (callbac return; } - var lastModified = req.getResponseHeader("Last-Modified"); - var date = new Date(lastModified); - Zotero.debug("Last successful storage sync was " + date); - ts = Zotero.Date.toUnixTimestamp(date); + if (req.status == 200) { + var lastModified = req.getResponseHeader("Last-Modified"); + var date = new Date(lastModified); + Zotero.debug("Last successful storage sync was " + date); + ts = Zotero.Date.toUnixTimestamp(date); + } + else { + ts = null; + } } finally { callback(ts); diff --git a/chrome/content/zotero/xpcom/storage/zfs.js b/chrome/content/zotero/xpcom/storage/zfs.js index a30c830d3c..bef227de01 100644 --- a/chrome/content/zotero/xpcom/storage/zfs.js +++ b/chrome/content/zotero/xpcom/storage/zfs.js @@ -715,10 +715,16 @@ Zotero.Sync.Storage.Session.ZFS.prototype.getLastSyncTime = function (callback) return; } - var ts = req.responseText; - var date = new Date(req.responseText * 1000); - Zotero.debug("Last successful storage sync was " + date); - self._lastSyncTime = ts; + if (req.status == 200) { + var ts = req.responseText; + var date = new Date(req.responseText * 1000); + Zotero.debug("Last successful storage sync was " + date); + self._lastSyncTime = ts; + } + else { + var ts = null; + self._lastSyncTime = null; + } callback(ts); }); } @@ -726,6 +732,13 @@ Zotero.Sync.Storage.Session.ZFS.prototype.getLastSyncTime = function (callback) Zotero.Sync.Storage.Session.ZFS.prototype.setLastSyncTime = function (callback, useLastSyncTime) { if (useLastSyncTime) { + if (!this._lastSyncTime) { + if (callback) { + callback(); + } + return; + } + var sql = "REPLACE INTO version VALUES ('storage_zfs', ?)"; Zotero.DB.query(sql, { int: this._lastSyncTime });