From 5c1ffd1e2f301ea18412f27e5438515a15a525ac Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 8 Aug 2009 10:06:34 +0000 Subject: [PATCH] Reset storageModTime to 0 if < 0 and prevent setting < 0, though it shouldn't happen to begin with --- chrome/content/zotero/xpcom/schema.js | 4 ++++ chrome/content/zotero/xpcom/storage.js | 6 ++++++ userdata.sql | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index c519d7cf4..2b469ea25 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -2443,6 +2443,10 @@ Zotero.Schema = new function(){ Zotero.DB.query("UPDATE itemNotes SET sourceItemID=NULL WHERE sourceItemID=itemID"); } + if (i==61) { + Zotero.DB.query("UPDATE itemAttachments SET storageModTime=NULL WHERE storageModTime<0"); + } + Zotero.wait(); } diff --git a/chrome/content/zotero/xpcom/storage.js b/chrome/content/zotero/xpcom/storage.js index f438a4d56..9cd520844 100644 --- a/chrome/content/zotero/xpcom/storage.js +++ b/chrome/content/zotero/xpcom/storage.js @@ -343,6 +343,12 @@ Zotero.Sync.Storage = new function () { * attachment item */ this.setSyncedModificationTime = function (itemID, mtime, updateItem) { + if (mtime < 0) { + Components.utils.reportError("Invalid file mod time " + mtime + + " in Zotero.Storage.setSyncedModificationTime()"); + mtime = 0; + } + Zotero.DB.beginTransaction(); var sql = "UPDATE itemAttachments SET storageModTime=? WHERE itemID=?"; diff --git a/userdata.sql b/userdata.sql index e624cff6c..fbeb0c50d 100644 --- a/userdata.sql +++ b/userdata.sql @@ -1,4 +1,4 @@ --- 60 +-- 61 -- This file creates tables containing user-specific data for new users -- -- any changes made here must be mirrored in transition steps in schema.js::_migrateSchema()