commit 5be1b75b2b8d97451961eb3b44f76367c836dc13
parent e4fd15c228d2a8ec9a850108433c0ca0828e11c1
Author: Dan Stillman <dstillman@zotero.org>
Date: Wed, 16 Sep 2009 03:37:14 +0000
Fix for "Invalid integer value 'Not found' [QUERY: REPLACE INTO version VALUES ('storage_zfs', ?)]"
Diffstat:
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
@@ -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
@@ -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 });