From 3f43e0f1709862cadbe80e1a9045c3f5279e3984 Mon Sep 17 00:00:00 2001 From: aurimasv Date: Thu, 1 Nov 2012 04:50:24 -0500 Subject: [PATCH] Fix searching for non-existing attachments with relative paths --- .../content/zotero/xpcom/translation/translate_item.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/translation/translate_item.js b/chrome/content/zotero/xpcom/translation/translate_item.js index fb4db78d4..4e3ab6d54 100644 --- a/chrome/content/zotero/xpcom/translation/translate_item.js +++ b/chrome/content/zotero/xpcom/translation/translate_item.js @@ -239,7 +239,7 @@ Zotero.Translate.ItemSaver.prototype = { var newItem = Zotero.Items.get(myID); } else { var file = this._parsePath(attachment.path); - if(!file || !file.exists()) return; + if(!file) return; if (attachment.url) { var myID = Zotero.Attachments.importSnapshotFromFile(file, @@ -297,13 +297,15 @@ Zotero.Translate.ItemSaver.prototype = { return false; } - if(!file.exists() && path[0] !== "/" && path.substr(0, 5).toLowerCase() !== "file:") { + if(file.exists()) { + return file; + } else if(path[0] !== "/" && path.substr(0, 5).toLowerCase() !== "file:") { // This looks like a relative path, but it might actually be an absolute path, because // some people are not quite there. var newFile = this._parsePath("/"+path); - if(newFile.exists()) return newFile; + if(newFile && newFile.exists()) return newFile; } - return file; + return false; }, "_saveAttachmentDownload":function(attachment, parentID) {