Be sure to clean up temp attachment storage dir in importFromDocument()
This commit is contained in:
parent
fcb6e0c068
commit
37063f639f
1 changed files with 75 additions and 77 deletions
|
@ -566,6 +566,7 @@ Zotero.Attachments = new function(){
|
|||
}
|
||||
|
||||
var tmpDir = yield this.createTemporaryStorageDirectory();
|
||||
try {
|
||||
var tmpFile = tmpDir.clone();
|
||||
var fileName = Zotero.File.truncateFileName(_getFileNameFromURL(url, contentType), 100);
|
||||
tmpFile.append(fileName);
|
||||
|
@ -616,10 +617,6 @@ Zotero.Attachments = new function(){
|
|||
else if (parentItemID) {
|
||||
let {libraryID: parentLibraryID, key: parentKey} =
|
||||
Zotero.Items.getLibraryAndKeyFromID(parentItemID);
|
||||
Zotero.debug('==-=');
|
||||
Zotero.debug(parentItemID);
|
||||
Zotero.debug(parentLibraryID);
|
||||
Zotero.debug(parentKey);
|
||||
attachmentItem.libraryID = parentLibraryID;
|
||||
}
|
||||
attachmentItem.setField('title', title);
|
||||
|
@ -642,8 +639,9 @@ Zotero.Attachments = new function(){
|
|||
|
||||
attachmentItem.attachmentPath = destFile.path;
|
||||
yield attachmentItem.save();
|
||||
}.bind(this))
|
||||
.catch(function (e) {
|
||||
}.bind(this));
|
||||
}
|
||||
catch (e) {
|
||||
Zotero.debug(e, 1);
|
||||
|
||||
// Clean up
|
||||
|
@ -660,7 +658,7 @@ Zotero.Attachments = new function(){
|
|||
}
|
||||
|
||||
throw e;
|
||||
});
|
||||
}
|
||||
|
||||
// We don't have any way of knowing that the file is flushed to disk,
|
||||
// so we just wait a second before indexing and hope for the best.
|
||||
|
|
Loading…
Add table
Reference in a new issue