commit e1986b460e6a38c191c87229f77019ad174e2248 parent eb42152c420c3c8017c5be97105ffe21949a76aa Author: Dan Stillman <dstillman@zotero.org> Date: Sun, 14 May 2017 05:06:37 -0400 Fix failed export due to missing attachment path Diffstat:
| M | chrome/content/zotero/xpcom/translation/translate_item.js | | | 11 | +++++++++-- |
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/chrome/content/zotero/xpcom/translation/translate_item.js b/chrome/content/zotero/xpcom/translation/translate_item.js @@ -792,9 +792,16 @@ Zotero.Translate.ItemGetter.prototype = { var exportDir = this._exportFileDirectory; // Add path and filename if not an internet link - var attachFile = Zotero.File.pathToFile(attachmentArray.localPath); + let attachFile; + if (attachmentArray.localPath) { + attachFile = Zotero.File.pathToFile(attachmentArray.localPath); + } + else { + Zotero.logError(`Path doesn't exist for attachment ${attachment.libraryKey} ` + + '-- not exporting file'); + } // TODO: Make async, but that will require translator changes - if (attachFile.exists()) { + if (attachFile && attachFile.exists()) { attachmentArray.defaultPath = "files/" + attachment.id + "/" + attachFile.leafName; attachmentArray.filename = attachFile.leafName;