You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-23 22:36:32 +02:00
Desktop, Cli: Fixed attachments being out of order when importing Enex file
This commit is contained in:
@@ -150,17 +150,10 @@ async function processNoteResource(resource) {
|
|||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveNoteResources(note, importOptions) {
|
async function saveNoteResources(note) {
|
||||||
let resourcesCreated = 0;
|
let resourcesCreated = 0;
|
||||||
for (let i = 0; i < note.resources.length; i++) {
|
for (let i = 0; i < note.resources.length; i++) {
|
||||||
let resource = note.resources[i];
|
const resource = note.resources[i];
|
||||||
|
|
||||||
try {
|
|
||||||
resource = await processNoteResource(resource);
|
|
||||||
} catch (error) {
|
|
||||||
importOptions.onError(error);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const toSave = Object.assign({}, resource);
|
const toSave = Object.assign({}, resource);
|
||||||
delete toSave.dataFilePath;
|
delete toSave.dataFilePath;
|
||||||
@@ -298,6 +291,20 @@ function importEnex(parentFolderId, filePath, importOptions = null) {
|
|||||||
|
|
||||||
while (notes.length) {
|
while (notes.length) {
|
||||||
const note = notes.shift();
|
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' ?
|
const body = importOptions.outputFormat === 'html' ?
|
||||||
await enexXmlToHtml(note.bodyXml, note.resources) :
|
await enexXmlToHtml(note.bodyXml, note.resources) :
|
||||||
await enexXmlToMd(note.bodyXml, note.resources);
|
await enexXmlToMd(note.bodyXml, note.resources);
|
||||||
|
|||||||
Reference in New Issue
Block a user