1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Deskop, Cli: Fixes #10125: ENEX does not import correctly when title of note matches the name of the attachment

This commit is contained in:
Laurent Cozic
2024-03-18 16:00:39 +00:00
parent 3d2c100fe9
commit 40db753417
3 changed files with 34 additions and 3 deletions

View File

@@ -293,6 +293,9 @@ const preProcessFile = async (filePath: string): Promise<string> => {
// return newFilePath;
};
const isEvernoteUrl = (url: string) => {
return url.toLowerCase().startsWith('evernote://');
};
const restoreNoteLinks = async (notes: SavedNote[], noteTitlesToIds: Record<string, string[]>, importOptions: ImportOptions) => {
// --------------------------------------------------------
@@ -309,6 +312,8 @@ const restoreNoteLinks = async (notes: SavedNote[], noteTitlesToIds: Record<stri
let noteChanged = false;
for (const link of links) {
if (!isEvernoteUrl(link.url)) continue;
const matchingNoteIds = noteTitlesToIds[link.title];
if (matchingNoteIds && matchingNoteIds.length === 1) {
note.body = note.body.replace(link.url, `:/${matchingNoteIds[0]}`);