diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index eff18de43..9889b72a0 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -24,6 +24,7 @@ */ Zotero.Attachments = new function(){ + // Keep in sync with Zotero.Schema.integrityCheck() this.LINK_MODE_IMPORTED_FILE = 0; this.LINK_MODE_IMPORTED_URL = 1; this.LINK_MODE_LINKED_FILE = 2; diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index 0bc14ddb9..3ecab174f 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -349,7 +349,10 @@ Zotero.Item.prototype._parseRowData = function(row) { break; case 'attachmentLinkMode': - val = val !== null ? parseInt(val) : false; + val = val !== null + ? parseInt(val) + // Shouldn't happen + : Zotero.Attachments.LINK_MODE_IMPORTED_URL; break; case 'attachmentPath': diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index a833c26fc..8a61736be 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -1329,6 +1329,11 @@ Zotero.Schema = new function(){ [ "SELECT COUNT(*) > 1 FROM fulltextItems WHERE itemID NOT IN (SELECT itemID FROM items WHERE itemTypeID=14)", "DELETE FROM fulltextItems WHERE itemID NOT IN (SELECT itemID FROM items WHERE itemTypeID=14)" + ], + // Invalid link mode -- set to imported url + [ + "SELECT COUNT(*) > 1 FROM itemAttachments WHERE linkMode NOT IN (0,1,2,3)", + "UPDATE itemAttachments SET linkMode=1 WHERE linkMode NOT IN (0,1,2,3)" ] ];