diff --git a/chrome/content/zotero/xpcom/data/library.js b/chrome/content/zotero/xpcom/data/library.js index 24884a9013..51d61d3136 100644 --- a/chrome/content/zotero/xpcom/data/library.js +++ b/chrome/content/zotero/xpcom/data/library.js @@ -291,10 +291,12 @@ Zotero.Library.prototype._set = function(prop, val) { if (newVal != val) { throw new Error(`${prop} must be an integer (${typeof val} '${val}' given)`); } + // Ensure that it is never decreasing, unless it is being set to -1 + // by Reset File Sync History + if (val != -1 && val < this._libraryStorageVersion) { + throw new Error(prop + ' cannot decrease'); + } val = newVal; - - // Ensure that it is never decreasing - if (val < this._libraryStorageVersion) throw new Error(prop + ' cannot decrease'); break; case '_libraryLastSync': diff --git a/chrome/content/zotero/xpcom/storage/storageLocal.js b/chrome/content/zotero/xpcom/storage/storageLocal.js index 6d15eedda1..a33c9be365 100644 --- a/chrome/content/zotero/xpcom/storage/storageLocal.js +++ b/chrome/content/zotero/xpcom/storage/storageLocal.js @@ -550,6 +550,10 @@ Zotero.Sync.Storage.Local = { } sql = "UPDATE itemAttachments SET syncState=? WHERE itemID IN (" + sql + ")"; await Zotero.DB.queryAsync(sql, [this.SYNC_STATE_TO_UPLOAD].concat(params)); + + var library = Zotero.Libraries.get(libraryID); + library.storageVersion = -1; + await library.save(); }.bind(this)); },