From 856122762230fe3238730d5b93b4b120403717e2 Mon Sep 17 00:00:00 2001 From: FliegendeWurst <2012gdwu@web.de> Date: Sun, 6 Oct 2019 18:23:39 +0200 Subject: [PATCH] Import: use upload mime type if mime cannot be detected from filename (#651) --- src/services/import/single.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/services/import/single.js b/src/services/import/single.js index c46bb691a..9aafd0fd7 100644 --- a/src/services/import/single.js +++ b/src/services/import/single.js @@ -42,12 +42,13 @@ async function importImage(file, parentNote, importContext) { async function importFile(importContext, file, parentNote) { const originalName = file.originalname; const size = file.size; + const mime = mimeService.getMime(originalName); const {note} = await noteService.createNote(parentNote.noteId, originalName, file.buffer, { target: 'into', isProtected: parentNote.isProtected && protectedSessionService.isProtectedSessionAvailable(), type: 'file', - mime: mimeService.getMime(originalName), + mime: mime === false ? file.mimetype : mime, attributes: [ { type: "label", name: "originalFileName", value: originalName }, { type: "label", name: "fileSize", value: size }