From 5b00b8b98bce97d1cb493e8c6d435714bf7e1760 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Tue, 15 May 2012 17:23:12 -0400 Subject: [PATCH] Don't create missing attachments if files are missing on import --- .../zotero/xpcom/translation/translate_item.js | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/chrome/content/zotero/xpcom/translation/translate_item.js b/chrome/content/zotero/xpcom/translation/translate_item.js index 12a5025e5..42df3a3db 100644 --- a/chrome/content/zotero/xpcom/translation/translate_item.js +++ b/chrome/content/zotero/xpcom/translation/translate_item.js @@ -239,22 +239,9 @@ Zotero.Translate.ItemSaver.prototype = { var newItem = Zotero.Items.get(myID); } else { var file = this._parsePath(attachment.path); - if(!file) return; + if(!file || !file.exists()) return; - if (!file.exists()) { - // use attachment title if possible, or else file leaf name - var title = attachment.title; - if(!title) { - title = file.leafName; - } - - var myID = Zotero.Attachments.createMissingAttachment( - attachment.url ? Zotero.Attachments.LINK_MODE_IMPORTED_URL - : Zotero.Attachments.LINK_MODE_IMPORTED_FILE, - file, attachment.url ? attachment.url : null, title, - attachment.mimeType, attachment.charset, parentID); - } - else if (attachment.url) { + if (attachment.url) { var myID = Zotero.Attachments.importSnapshotFromFile(file, attachment.url, attachment.title, attachment.mimeType, attachment.charset, parentID);