mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
Import: use upload mime type if mime cannot be detected from filename (#651)
This commit is contained in:
parent
8859e2ac40
commit
8561227622
@ -42,12 +42,13 @@ async function importImage(file, parentNote, importContext) {
|
|||||||
async function importFile(importContext, file, parentNote) {
|
async function importFile(importContext, file, parentNote) {
|
||||||
const originalName = file.originalname;
|
const originalName = file.originalname;
|
||||||
const size = file.size;
|
const size = file.size;
|
||||||
|
const mime = mimeService.getMime(originalName);
|
||||||
|
|
||||||
const {note} = await noteService.createNote(parentNote.noteId, originalName, file.buffer, {
|
const {note} = await noteService.createNote(parentNote.noteId, originalName, file.buffer, {
|
||||||
target: 'into',
|
target: 'into',
|
||||||
isProtected: parentNote.isProtected && protectedSessionService.isProtectedSessionAvailable(),
|
isProtected: parentNote.isProtected && protectedSessionService.isProtectedSessionAvailable(),
|
||||||
type: 'file',
|
type: 'file',
|
||||||
mime: mimeService.getMime(originalName),
|
mime: mime === false ? file.mimetype : mime,
|
||||||
attributes: [
|
attributes: [
|
||||||
{ type: "label", name: "originalFileName", value: originalName },
|
{ type: "label", name: "originalFileName", value: originalName },
|
||||||
{ type: "label", name: "fileSize", value: size }
|
{ type: "label", name: "fileSize", value: size }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user