commit 5b00b8b98bce97d1cb493e8c6d435714bf7e1760
parent b3a26828531bd6d94001e0950af2212d0fbd8b33
Author: Simon Kornblith <simon@simonster.com>
Date: Tue, 15 May 2012 17:23:12 -0400
Don't create missing attachments if files are missing on import
Diffstat:
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
@@ -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);