Fix potential error dragging attachment with missing file

This commit is contained in:
Dan Stillman 2017-03-03 16:39:37 -05:00
parent fe9fc8bc5a
commit 9ea82bb6cd

View file

@ -1092,7 +1092,7 @@ Zotero.Attachments = new function(){
yield newAttachment.save();
// Copy over files if they exist
if (newAttachment.isImportedAttachment() && attachment.getFile()) {
if (newAttachment.isImportedAttachment() && (yield attachment.fileExists())) {
let dir = Zotero.Attachments.getStorageDirectory(attachment);
let newDir = yield Zotero.Attachments.createDirectoryForItem(newAttachment);
yield Zotero.File.copyDirectory(dir, newDir);