mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Desktop, Cli: Fixed attachments being out of order when importing Enex file
This commit is contained in:
parent
71e5304298
commit
9cebbbe7cf
@ -150,17 +150,10 @@ async function processNoteResource(resource) {
|
||||
return resource;
|
||||
}
|
||||
|
||||
async function saveNoteResources(note, importOptions) {
|
||||
async function saveNoteResources(note) {
|
||||
let resourcesCreated = 0;
|
||||
for (let i = 0; i < note.resources.length; i++) {
|
||||
let resource = note.resources[i];
|
||||
|
||||
try {
|
||||
resource = await processNoteResource(resource);
|
||||
} catch (error) {
|
||||
importOptions.onError(error);
|
||||
continue;
|
||||
}
|
||||
const resource = note.resources[i];
|
||||
|
||||
const toSave = Object.assign({}, resource);
|
||||
delete toSave.dataFilePath;
|
||||
@ -298,6 +291,20 @@ function importEnex(parentFolderId, filePath, importOptions = null) {
|
||||
|
||||
while (notes.length) {
|
||||
const note = notes.shift();
|
||||
|
||||
for (let i = 0; i < note.resources.length; i++) {
|
||||
let resource = note.resources[i];
|
||||
|
||||
try {
|
||||
resource = await processNoteResource(resource);
|
||||
} catch (error) {
|
||||
importOptions.onError(error);
|
||||
continue;
|
||||
}
|
||||
|
||||
note.resources[i] = resource;
|
||||
}
|
||||
|
||||
const body = importOptions.outputFormat === 'html' ?
|
||||
await enexXmlToHtml(note.bodyXml, note.resources) :
|
||||
await enexXmlToMd(note.bodyXml, note.resources);
|
||||
|
Loading…
Reference in New Issue
Block a user