Fix failed export due to missing attachment path
This commit is contained in:
parent
eb42152c42
commit
e1986b460e
1 changed files with 9 additions and 2 deletions
|
@ -792,9 +792,16 @@ Zotero.Translate.ItemGetter.prototype = {
|
||||||
var exportDir = this._exportFileDirectory;
|
var exportDir = this._exportFileDirectory;
|
||||||
|
|
||||||
// Add path and filename if not an internet link
|
// 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
|
// TODO: Make async, but that will require translator changes
|
||||||
if (attachFile.exists()) {
|
if (attachFile && attachFile.exists()) {
|
||||||
attachmentArray.defaultPath = "files/" + attachment.id + "/" + attachFile.leafName;
|
attachmentArray.defaultPath = "files/" + attachment.id + "/" + attachFile.leafName;
|
||||||
attachmentArray.filename = attachFile.leafName;
|
attachmentArray.filename = attachFile.leafName;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue