mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
server: Fix import of notes with type=file
This commit is contained in:
parent
1b0690ddfc
commit
d99cc11d8b
@ -107,5 +107,5 @@ export interface NoteRow {
|
|||||||
dateModified: string;
|
dateModified: string;
|
||||||
utcDateCreated: string;
|
utcDateCreated: string;
|
||||||
utcDateModified: string;
|
utcDateModified: string;
|
||||||
content?: string;
|
content?: string | Buffer;
|
||||||
}
|
}
|
||||||
|
@ -500,10 +500,6 @@ async function importZip(taskContext: TaskContext, fileBuffer: Buffer, importRoo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (typeof content !== "string") {
|
|
||||||
throw new Error("Incorrect content type.");
|
|
||||||
}
|
|
||||||
|
|
||||||
({note} = noteService.createNewNote({
|
({note} = noteService.createNewNote({
|
||||||
parentNoteId: parentNoteId,
|
parentNoteId: parentNoteId,
|
||||||
title: noteTitle || "",
|
title: noteTitle || "",
|
||||||
|
@ -7,7 +7,7 @@ export interface NoteParams {
|
|||||||
parentNoteId: string;
|
parentNoteId: string;
|
||||||
templateNoteId?: string;
|
templateNoteId?: string;
|
||||||
title: string;
|
title: string;
|
||||||
content: string;
|
content: string | Buffer;
|
||||||
/** text, code, file, image, search, book, relationMap, canvas, webView */
|
/** text, code, file, image, search, book, relationMap, canvas, webView */
|
||||||
type: NoteType;
|
type: NoteType;
|
||||||
/** default value is derived from default mimes for type */
|
/** default value is derived from default mimes for type */
|
||||||
|
@ -74,7 +74,7 @@ class NoteContentFulltextExp extends Expression {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isProtected) {
|
if (isProtected) {
|
||||||
if (!protectedSessionService.isProtectedSessionAvailable() || !content) {
|
if (!protectedSessionService.isProtectedSessionAvailable() || !content || typeof content !== "string") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ class NoteContentFulltextExp extends Expression {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!content) {
|
if (!content || typeof content !== "string") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user