server: Fix import of notes with type=file

This commit is contained in:
Elian Doran 2024-07-13 16:52:31 +03:00
parent 1b0690ddfc
commit d99cc11d8b
No known key found for this signature in database
4 changed files with 4 additions and 8 deletions

View File

@ -107,5 +107,5 @@ export interface NoteRow {
dateModified: string;
utcDateCreated: string;
utcDateModified: string;
content?: string;
content?: string | Buffer;
}

View File

@ -500,10 +500,6 @@ async function importZip(taskContext: TaskContext, fileBuffer: Buffer, importRoo
}
}
else {
if (typeof content !== "string") {
throw new Error("Incorrect content type.");
}
({note} = noteService.createNewNote({
parentNoteId: parentNoteId,
title: noteTitle || "",

View File

@ -7,7 +7,7 @@ export interface NoteParams {
parentNoteId: string;
templateNoteId?: string;
title: string;
content: string;
content: string | Buffer;
/** text, code, file, image, search, book, relationMap, canvas, webView */
type: NoteType;
/** default value is derived from default mimes for type */

View File

@ -74,7 +74,7 @@ class NoteContentFulltextExp extends Expression {
}
if (isProtected) {
if (!protectedSessionService.isProtectedSessionAvailable() || !content) {
if (!protectedSessionService.isProtectedSessionAvailable() || !content || typeof content !== "string") {
return;
}
@ -86,7 +86,7 @@ class NoteContentFulltextExp extends Expression {
}
}
if (!content) {
if (!content || typeof content !== "string") {
return;
}