mirror of
https://github.com/zadam/trilium.git
synced 2025-11-13 00:35:50 +01:00
server-ts: Port services/import/zip
This commit is contained in:
@@ -167,7 +167,7 @@ interface NoteParams {
|
||||
/** default is false */
|
||||
isExpanded?: boolean;
|
||||
/** default is empty string */
|
||||
prefix?: string;
|
||||
prefix?: string | null;
|
||||
/** default is the last existing notePosition in a parent + 10 */
|
||||
notePosition?: number;
|
||||
dateCreated?: string;
|
||||
@@ -657,7 +657,7 @@ function saveAttachments(note: BNote, content: string) {
|
||||
return content;
|
||||
}
|
||||
|
||||
function saveLinks(note: BNote, content: string) {
|
||||
function saveLinks(note: BNote, content: string | Buffer) {
|
||||
if ((note.type !== 'text' && note.type !== 'relationMap')
|
||||
|| (note.isProtected && !protectedSessionService.isProtectedSessionAvailable())) {
|
||||
return {
|
||||
@@ -669,7 +669,7 @@ function saveLinks(note: BNote, content: string) {
|
||||
const foundLinks: FoundLink[] = [];
|
||||
let forceFrontendReload = false;
|
||||
|
||||
if (note.type === 'text') {
|
||||
if (note.type === 'text' && typeof content === "string") {
|
||||
content = downloadImages(note.noteId, content);
|
||||
content = saveAttachments(note, content);
|
||||
|
||||
@@ -679,7 +679,7 @@ function saveLinks(note: BNote, content: string) {
|
||||
|
||||
({forceFrontendReload, content} = checkImageAttachments(note, content));
|
||||
}
|
||||
else if (note.type === 'relationMap') {
|
||||
else if (note.type === 'relationMap' && typeof content === "string") {
|
||||
findRelationMapLinks(content, foundLinks);
|
||||
}
|
||||
else {
|
||||
@@ -874,7 +874,7 @@ function getUndeletedParentBranchIds(noteId: string, deleteId: string) {
|
||||
AND parentNote.isDeleted = 0`, [noteId, deleteId]);
|
||||
}
|
||||
|
||||
function scanForLinks(note: BNote, content: string) {
|
||||
function scanForLinks(note: BNote, content: string | Buffer) {
|
||||
if (!note || !['text', 'relationMap'].includes(note.type)) {
|
||||
return;
|
||||
}
|
||||
@@ -896,7 +896,7 @@ function scanForLinks(note: BNote, content: string) {
|
||||
/**
|
||||
* Things which have to be executed after updating content, but asynchronously (separate transaction)
|
||||
*/
|
||||
async function asyncPostProcessContent(note: BNote, content: string) {
|
||||
async function asyncPostProcessContent(note: BNote, content: string | Buffer) {
|
||||
if (cls.isMigrationRunning()) {
|
||||
// this is rarely needed for migrations, but can cause trouble by e.g. triggering downloads
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user