You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-23 22:36:32 +02:00
Desktop, Cli: Fixes #8363: ENEX files that contain resources with invalid mime types are imported correctly
This commit is contained in:
@@ -6,9 +6,10 @@ import Resource from './models/Resource';
|
||||
import Setting from './models/Setting';
|
||||
import time from './time';
|
||||
import shim from './shim';
|
||||
import { NoteEntity } from './services/database/types';
|
||||
import { NoteEntity, ResourceEntity } from './services/database/types';
|
||||
import { enexXmlToMd } from './import-enex-md-gen';
|
||||
import { MarkupToHtml } from '@joplin/renderer';
|
||||
import { fileExtension } from './path-utils';
|
||||
const moment = require('moment');
|
||||
const { wrapError } = require('./errorUtils');
|
||||
const { enexXmlToHtml } = require('./import-enex-html-gen.js');
|
||||
@@ -196,10 +197,11 @@ async function saveNoteResources(note: ExtractedNote) {
|
||||
for (let i = 0; i < note.resources.length; i++) {
|
||||
const resource = note.resources[i];
|
||||
|
||||
const toSave = { ...resource };
|
||||
delete toSave.dataFilePath;
|
||||
delete toSave.dataEncoding;
|
||||
delete toSave.hasData;
|
||||
const toSave: ResourceEntity = { ...resource };
|
||||
delete (toSave as any).dataFilePath;
|
||||
delete (toSave as any).dataEncoding;
|
||||
delete (toSave as any).hasData;
|
||||
toSave.file_extension = fileExtension(resource.filename);
|
||||
|
||||
// The same resource sometimes appear twice in the same enex (exact same ID and file).
|
||||
// In that case, just skip it - it means two different notes might be linked to the
|
||||
|
||||
Reference in New Issue
Block a user