Skip to content

Build your personal knowledge base with Trilium Notes

chore(server): fix imports to validation error

Elian Doran3459d2906e81
diff --git a/apps/server/src/routes/api/attachments.ts b/apps/server/src/routes/api/attachments.ts
index b2c877fcb3..a466847a13 100644
--- a/apps/server/src/routes/api/attachments.ts
+++ b/apps/server/src/routes/api/attachments.ts
@@ -1,9 +1,10 @@
+import { ConvertAttachmentToNoteResponse } from "@triliumnext/commons";
+import { ValidationError } from "@triliumnext/core";
+import type { Request } from "express";
+
import becca from "../../becca/becca.js";
import blobService from "../../services/blob.js";
-import ValidationError from "../../errors/validation_error.js";
import imageService from "../../services/image.js";
-import type { Request } from "express";
-import { ConvertAttachmentToNoteResponse } from "@triliumnext/commons";
function getAttachmentBlob(req: Request) {
const preview = req.query.preview === "true";
@@ -34,7 +35,7 @@ function getAllAttachments(req: Request) {
function saveAttachment(req: Request) {
const { noteId } = req.params;
const { attachmentId, role, mime, title, content } = req.body;
- const matchByQuery = req.query.matchBy
+ const matchByQuery = req.query.matchBy;
const isValidMatchBy = (typeof matchByQuery === "string") && (matchByQuery === "attachmentId" || matchByQuery === "title");
const matchBy = isValidMatchBy ? matchByQuery : undefined;
diff --git a/apps/server/src/routes/api/attributes.ts b/apps/server/src/routes/api/attributes.ts
index 55c3e3e298..3b0ac83269 100644
--- a/apps/server/src/routes/api/attributes.ts
+++ b/apps/server/src/routes/api/attributes.ts
@@ -1,13 +1,12 @@
-"use strict";
+import { UpdateAttributeResponse } from "@triliumnext/commons";
+import { ValidationError } from "@triliumnext/core";
+import type { Request } from "express";
-import sql from "../../services/sql.js";
-import log from "../../services/log.js";
-import attributeService from "../../services/attributes.js";
-import BAttribute from "../../becca/entities/battribute.js";
import becca from "../../becca/becca.js";
-import ValidationError from "../../errors/validation_error.js";
-import type { Request } from "express";
-import { UpdateAttributeResponse } from "@triliumnext/commons";
+import BAttribute from "../../becca/entities/battribute.js";
+import attributeService from "../../services/attributes.js";
+import log from "../../services/log.js";
+import sql from "../../services/sql.js";
function getEffectiveNoteAttributes(req: Request) {
const note = becca.getNote(req.params.noteId);
@@ -47,7 +46,7 @@ function updateNoteAttribute(req: Request) {
}
attribute = new BAttribute({
- noteId: noteId,
+ noteId,
name: body.name,
type: body.type,
isInheritable: body.isInheritable
@@ -208,7 +207,7 @@ function createRelation(req: Request) {
if (!attribute) {
attribute = new BAttribute({
noteId: sourceNoteId,
- name: name,
+ name,
type: "relation",
value: targetNoteId
}).save();
diff --git a/apps/server/src/routes/api/autocomplete.ts b/apps/server/src/routes/api/autocomplete.ts
index 9915f58cb1..6d3deb33a6 100644
--- a/apps/server/src/routes/api/autocomplete.ts
+++ b/apps/server/src/routes/api/autocomplete.ts
@@ -1,8 +1,8 @@
+import { ValidationError } from "@triliumnext/core";
import type { Request } from "express";
import becca from "../../becca/becca.js";
import beccaService from "../../becca/becca_service.js";
-import ValidationError from "../../errors/validation_error.js";
import cls from "../../services/cls.js";
import log from "../../services/log.js";
import searchService from "../../services/search/services/search.js";
diff --git a/apps/server/src/routes/api/branches.ts b/apps/server/src/routes/api/branches.ts
index bf28fff988..8a21f8420c 100644
--- a/apps/server/src/routes/api/branches.ts
+++ b/apps/server/src/routes/api/branches.ts
@@ -1,8 +1,7 @@
-import { events as eventService } from "@triliumnext/core";
+import { events as eventService, ValidationError } from "@triliumnext/core";
import type { Request } from "express";
import becca from "../../becca/becca.js";
-import ValidationError from "../../errors/validation_error.js";
import branchService from "../../services/branches.js";
import entityChangesService from "../../services/entity_changes.js";
import eraseService from "../../services/erase.js";
diff --git a/apps/server/src/routes/api/clipper.ts b/apps/server/src/routes/api/clipper.ts
index 133c35a88e..c73896f15d 100644
--- a/apps/server/src/routes/api/clipper.ts
+++ b/apps/server/src/routes/api/clipper.ts
@@ -1,9 +1,9 @@
+import { ValidationError } from "@triliumnext/core";
import type { Request } from "express";
import { parse } from "node-html-parser";
import path from "path";
import type BNote from "../../becca/entities/bnote.js";
-import ValidationError from "../../errors/validation_error.js";
import appInfo from "../../services/app_info.js";
import attributeFormatter from "../../services/attribute_formatter.js";
import attributeService from "../../services/attributes.js";
@@ -38,7 +38,7 @@ async function addClipping(req: Request) {
if (!clippingNote) {
clippingNote = noteService.createNewNote({
parentNoteId: clipperInbox.noteId,
- title: title,
+ title,
content: "",
type: "text"
}).note;
@@ -198,11 +198,11 @@ function openNote(req: Request) {
return {
result: "ok"
};
- } else {
- return {
- result: "open-in-browser"
- };
- }
+ }
+ return {
+ result: "open-in-browser"
+ };
+
}
function handshake() {
diff --git a/apps/server/src/routes/api/database.ts b/apps/server/src/routes/api/database.ts
index c29f6e9aaa..8ec4b10f46 100644
--- a/apps/server/src/routes/api/database.ts
+++ b/apps/server/src/routes/api/database.ts
@@ -1,15 +1,14 @@
-"use strict";
+import { BackupDatabaseNowResponse, DatabaseCheckIntegrityResponse } from "@triliumnext/commons";
+import { ValidationError } from "@triliumnext/core";
+import type { Request } from "express";
-import sql from "../../services/sql.js";
-import log from "../../services/log.js";
-import backupService from "../../services/backup.js";
+import becca_loader from "../../becca/becca_loader.js";
import anonymizationService from "../../services/anonymization.js";
+import backupService from "../../services/backup.js";
import consistencyChecksService from "../../services/consistency_checks.js";
-import type { Request } from "express";
-import ValidationError from "../../errors/validation_error.js";
+import log from "../../services/log.js";
+import sql from "../../services/sql.js";
import sql_init from "../../services/sql_init.js";
-import becca_loader from "../../becca/becca_loader.js";
-import { BackupDatabaseNowResponse, DatabaseCheckIntegrityResponse } from "@triliumnext/commons";
function getExistingBackups() {
return backupService.getExistingBackups();
diff --git a/apps/server/src/routes/api/files.ts b/apps/server/src/routes/api/files.ts
index 4a6e17382b..2095f3b712 100644
--- a/apps/server/src/routes/api/files.ts
+++ b/apps/server/src/routes/api/files.ts
@@ -1,5 +1,4 @@
-
-
+import { ValidationError } from "@triliumnext/core";
import chokidar from "chokidar";
import type { Request, Response } from "express";
import fs from "fs";
@@ -9,7 +8,6 @@ import tmp from "tmp";
import becca from "../../becca/becca.js";
import type BAttachment from "../../becca/entities/battachment.js";
import type BNote from "../../becca/entities/bnote.js";
-import ValidationError from "../../errors/validation_error.js";
import dataDirs from "../../services/data_dir.js";
import log from "../../services/log.js";
import noteService from "../../services/notes.js";
diff --git a/apps/server/src/routes/api/import.ts b/apps/server/src/routes/api/import.ts
index 273dc1e1da..45e3f5f0be 100644
--- a/apps/server/src/routes/api/import.ts
+++ b/apps/server/src/routes/api/import.ts
@@ -1,18 +1,17 @@
-"use strict";
+import { ValidationError } from "@triliumnext/core";
+import type { Request } from "express";
+import path from "path";
+import becca from "../../becca/becca.js";
+import beccaLoader from "../../becca/becca_loader.js";
+import type BNote from "../../becca/entities/bnote.js";
+import cls from "../../services/cls.js";
import enexImportService from "../../services/import/enex.js";
import opmlImportService from "../../services/import/opml.js";
-import zipImportService from "../../services/import/zip.js";
import singleImportService from "../../services/import/single.js";
-import cls from "../../services/cls.js";
-import path from "path";
-import becca from "../../becca/becca.js";
-import beccaLoader from "../../becca/becca_loader.js";
+import zipImportService from "../../services/import/zip.js";
import log from "../../services/log.js";
import TaskContext from "../../services/task_context.js";
-import ValidationError from "../../errors/validation_error.js";
-import type { Request } from "express";
-import type BNote from "../../becca/entities/bnote.js";
import { safeExtractMessageAndStackFromError } from "../../services/utils.js";
async function importNotesToBranch(req: Request) {
@@ -88,7 +87,7 @@ async function importNotesToBranch(req: Request) {
setTimeout(
() =>
taskContext.taskSucceeded({
- parentNoteId: parentNoteId,
+ parentNoteId,
importedNoteId: note?.noteId
}),
1000
@@ -138,7 +137,7 @@ function importAttachmentsToNote(req: Request) {
setTimeout(
() =>
taskContext.taskSucceeded({
- parentNoteId: parentNoteId
+ parentNoteId
}),
1000
);
diff --git a/apps/server/src/routes/api/notes.ts b/apps/server/src/routes/api/notes.ts
index 3c6db40549..c3f1746a62 100644
--- a/apps/server/src/routes/api/notes.ts
+++ b/apps/server/src/routes/api/notes.ts
@@ -1,18 +1,17 @@
-"use strict";
+import type { AttributeRow, CreateChildrenResponse, DeleteNotesPreview, MetadataResponse } from "@triliumnext/commons";
+import { ValidationError } from "@triliumnext/core";
+import type { Request } from "express";
-import noteService from "../../services/notes.js";
+import becca from "../../becca/becca.js";
+import type BBranch from "../../becca/entities/bbranch.js";
+import blobService from "../../services/blob.js";
import eraseService from "../../services/erase.js";
-import treeService from "../../services/tree.js";
-import sql from "../../services/sql.js";
-import utils from "../../services/utils.js";
import log from "../../services/log.js";
+import noteService from "../../services/notes.js";
+import sql from "../../services/sql.js";
import TaskContext from "../../services/task_context.js";
-import becca from "../../becca/becca.js";
-import ValidationError from "../../errors/validation_error.js";
-import blobService from "../../services/blob.js";
-import type { Request } from "express";
-import type BBranch from "../../becca/entities/bbranch.js";
-import type { AttributeRow, CreateChildrenResponse, DeleteNotesPreview, MetadataResponse } from "@triliumnext/commons";
+import treeService from "../../services/tree.js";
+import utils from "../../services/utils.js";
/**
* @swagger
diff --git a/apps/server/src/routes/api/options.ts b/apps/server/src/routes/api/options.ts
index e7377bdfdb..123c048043 100644
--- a/apps/server/src/routes/api/options.ts
+++ b/apps/server/src/routes/api/options.ts
@@ -1,9 +1,9 @@
import type { OptionNames } from "@triliumnext/commons";
+import { ValidationError } from "@triliumnext/core";
import type { Request } from "express";
-import ValidationError from "../../errors/validation_error.js";
import config from "../../services/config.js";
import { changeLanguage, getLocales } from "../../services/i18n.js";
import log from "../../services/log.js";
diff --git a/apps/server/src/routes/api/password.ts b/apps/server/src/routes/api/password.ts
index 8a9c93940f..959357893a 100644
--- a/apps/server/src/routes/api/password.ts
+++ b/apps/server/src/routes/api/password.ts
@@ -1,16 +1,15 @@
-"use strict";
+import { ChangePasswordResponse } from "@triliumnext/commons";
+import { ValidationError } from "@triliumnext/core";
+import type { Request } from "express";
import passwordService from "../../services/encryption/password.js";
-import ValidationError from "../../errors/validation_error.js";
-import type { Request } from "express";
-import { ChangePasswordResponse } from "@triliumnext/commons";
function changePassword(req: Request): ChangePasswordResponse {
if (passwordService.isPasswordSet()) {
return passwordService.changePassword(req.body.current_password, req.body.new_password);
- } else {
- return passwordService.setPassword(req.body.new_password);
}
+ return passwordService.setPassword(req.body.new_password);
+
}
function resetPassword(req: Request) {
diff --git a/apps/server/src/routes/api/search.ts b/apps/server/src/routes/api/search.ts
index cbd5845299..fa2f8a2595 100644
--- a/apps/server/src/routes/api/search.ts
+++ b/apps/server/src/routes/api/search.ts
@@ -1,17 +1,15 @@
-"use strict";
-
+import { ValidationError } from "@triliumnext/core";
import type { Request } from "express";
import becca from "../../becca/becca.js";
-import SearchContext from "../../services/search/search_context.js";
-import searchService, { EMPTY_RESULT, type SearchNoteResult } from "../../services/search/services/search.js";
+import beccaService from "../../becca/becca_service.js";
+import attributeFormatter from "../../services/attribute_formatter.js";
import bulkActionService from "../../services/bulk_actions.js";
import cls from "../../services/cls.js";
-import attributeFormatter from "../../services/attribute_formatter.js";
-import ValidationError from "../../errors/validation_error.js";
-import type SearchResult from "../../services/search/search_result.js";
import hoistedNoteService from "../../services/hoisted_note.js";
-import beccaService from "../../becca/becca_service.js";
+import SearchContext from "../../services/search/search_context.js";
+import type SearchResult from "../../services/search/search_result.js";
+import searchService, { EMPTY_RESULT, type SearchNoteResult } from "../../services/search/services/search.js";
function searchFromNote(req: Request): SearchNoteResult {
const note = becca.getNoteOrThrow(req.params.noteId);
@@ -82,7 +80,7 @@ function quickSearch(req: Request) {
highlightedContentSnippet: result.highlightedContentSnippet,
attributeSnippet: result.attributeSnippet,
highlightedAttributeSnippet: result.highlightedAttributeSnippet,
- icon: icon
+ icon
};
});
@@ -90,7 +88,7 @@ function quickSearch(req: Request) {
return {
searchResultNoteIds: resultNoteIds,
- searchResults: searchResults,
+ searchResults,
error: searchContext.getError()
};
}
diff --git a/apps/server/src/routes/api/sql.ts b/apps/server/src/routes/api/sql.ts
index 33cd61b5e7..71c404a9d0 100644
--- a/apps/server/src/routes/api/sql.ts
+++ b/apps/server/src/routes/api/sql.ts
@@ -1,9 +1,8 @@
-"use strict";
+import { ValidationError } from "@triliumnext/core";
+import type { Request } from "express";
-import sql from "../../services/sql.js";
import becca from "../../becca/becca.js";
-import type { Request } from "express";
-import ValidationError from "../../errors/validation_error.js";
+import sql from "../../services/sql.js";
import { safeExtractMessageAndStackFromError } from "../../services/utils.js";
interface Table {
diff --git a/apps/server/src/routes/api/sync.ts b/apps/server/src/routes/api/sync.ts
index 5e1c53041c..da55e4ba4b 100644
--- a/apps/server/src/routes/api/sync.ts
+++ b/apps/server/src/routes/api/sync.ts
@@ -1,21 +1,20 @@
-"use strict";
+import { type EntityChange,SyncTestResponse } from "@triliumnext/commons";
+import { ValidationError } from "@triliumnext/core";
+import type { Request } from "express";
+import { t } from "i18next";
-import syncService from "../../services/sync.js";
-import syncUpdateService from "../../services/sync_update.js";
+import consistencyChecksService from "../../services/consistency_checks.js";
+import contentHashService from "../../services/content_hash.js";
import entityChangesService from "../../services/entity_changes.js";
+import log from "../../services/log.js";
+import optionService from "../../services/options.js";
import sql from "../../services/sql.js";
import sqlInit from "../../services/sql_init.js";
-import optionService from "../../services/options.js";
-import contentHashService from "../../services/content_hash.js";
-import log from "../../services/log.js";
+import syncService from "../../services/sync.js";
import syncOptions from "../../services/sync_options.js";
+import syncUpdateService from "../../services/sync_update.js";
import utils, { safeExtractMessageAndStackFromError } from "../../services/utils.js";
import ws from "../../services/ws.js";
-import type { Request } from "express";
-import ValidationError from "../../errors/validation_error.js";
-import consistencyChecksService from "../../services/consistency_checks.js";
-import { t } from "i18next";
-import { SyncTestResponse, type EntityChange } from "@triliumnext/commons";
async function testSync(): Promise<SyncTestResponse> {
try {
@@ -287,10 +286,10 @@ function update(req: Request) {
if (pageIndex !== pageCount - 1) {
return;
- } else {
- body = JSON.parse(partialRequests[requestId].payload);
- delete partialRequests[requestId];
- }
+ }
+ body = JSON.parse(partialRequests[requestId].payload);
+ delete partialRequests[requestId];
+
}
const { entities, instanceId } = body;
diff --git a/apps/server/src/routes/login.ts b/apps/server/src/routes/login.ts
index 2a505a9938..bcb81ad85e 100644
--- a/apps/server/src/routes/login.ts
+++ b/apps/server/src/routes/login.ts
@@ -1,18 +1,19 @@
+import { ValidationError } from "@triliumnext/core";
import crypto from "crypto";
-import utils from "../services/utils.js";
-import optionService from "../services/options.js";
+import type { Request, Response } from 'express';
+
+import appPath from "../services/app_path.js";
+import assetPath, { assetUrlFragment } from "../services/asset_path.js";
import myScryptService from "../services/encryption/my_scrypt.js";
-import log from "../services/log.js";
+import openIDEncryption from '../services/encryption/open_id_encryption.js';
import passwordService from "../services/encryption/password.js";
-import assetPath, { assetUrlFragment } from "../services/asset_path.js";
-import appPath from "../services/app_path.js";
-import ValidationError from "../errors/validation_error.js";
-import type { Request, Response } from 'express';
-import totp from '../services/totp.js';
import recoveryCodeService from '../services/encryption/recovery_codes.js';
-import openID from '../services/open_id.js';
-import openIDEncryption from '../services/encryption/open_id_encryption.js';
import { getCurrentLocale } from "../services/i18n.js";
+import log from "../services/log.js";
+import openID from '../services/open_id.js';
+import optionService from "../services/options.js";
+import totp from '../services/totp.js';
+import utils from "../services/utils.js";
function loginPage(req: Request, res: Response) {
// Login page is triggered twice. Once here, and another time (see sendLoginError) if the password is failed.
@@ -23,9 +24,9 @@ function loginPage(req: Request, res: Response) {
ssoEnabled: openID.isOpenIDEnabled(),
ssoIssuerName: openID.getSSOIssuerName(),
ssoIssuerIcon: openID.getSSOIssuerIcon(),
- assetPath: assetPath,
+ assetPath,
assetPathFragment: assetUrlFragment,
- appPath: appPath,
+ appPath,
currentLocale: getCurrentLocale()
});
}
@@ -181,9 +182,9 @@ function sendLoginError(req: Request, res: Response, errorType: 'password' | 'to
wrongTotp: errorType === 'totp',
totpEnabled: totp.isTotpEnabled(),
ssoEnabled: openID.isOpenIDEnabled(),
- assetPath: assetPath,
+ assetPath,
assetPathFragment: assetUrlFragment,
- appPath: appPath,
+ appPath,
currentLocale: getCurrentLocale()
});
}
diff --git a/apps/server/src/services/export/zip.ts b/apps/server/src/services/export/zip.ts
index 4a9f140411..dbab81687e 100644
--- a/apps/server/src/services/export/zip.ts
+++ b/apps/server/src/services/export/zip.ts
@@ -1,29 +1,28 @@
-"use strict";
-
-import dateUtils from "../date_utils.js";
+import { NoteType } from "@triliumnext/commons";
+import { ValidationError } from "@triliumnext/core";
+import archiver from "archiver";
+import type { Response } from "express";
+import fs from "fs";
import path from "path";
-import packageInfo from "../../../package.json" with { type: "json" };
-import { getContentDisposition } from "../utils.js";
-import protectedSessionService from "../protected_session.js";
import sanitize from "sanitize-filename";
-import fs from "fs";
+
+import packageInfo from "../../../package.json" with { type: "json" };
import becca from "../../becca/becca.js";
-import archiver from "archiver";
+import BBranch from "../../becca/entities/bbranch.js";
+import type BNote from "../../becca/entities/bnote.js";
+import dateUtils from "../date_utils.js";
import log from "../log.js";
-import TaskContext from "../task_context.js";
-import ValidationError from "../../errors/validation_error.js";
-import type NoteMeta from "../meta/note_meta.js";
import type AttachmentMeta from "../meta/attachment_meta.js";
import type AttributeMeta from "../meta/attribute_meta.js";
-import BBranch from "../../becca/entities/bbranch.js";
-import type { Response } from "express";
+import type NoteMeta from "../meta/note_meta.js";
import type { NoteMetaFile } from "../meta/note_meta.js";
-import HtmlExportProvider from "./zip/html.js";
+import protectedSessionService from "../protected_session.js";
+import TaskContext from "../task_context.js";
+import { getContentDisposition } from "../utils.js";
import { AdvancedExportOptions, type ExportFormat, ZipExportProviderData } from "./zip/abstract_provider.js";
+import HtmlExportProvider from "./zip/html.js";
import MarkdownExportProvider from "./zip/markdown.js";
import ShareThemeExportProvider from "./zip/share_theme.js";
-import type BNote from "../../becca/entities/bnote.js";
-import { NoteType } from "@triliumnext/commons";
async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch, format: ExportFormat, res: Response | fs.WriteStream, setHeaders = true, zipExportOptions?: AdvancedExportOptions) {
if (!["html", "markdown", "share"].includes(format)) {
@@ -73,11 +72,11 @@ async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch,
} while (newName in existingFileNames);
return `${index}_${fileName}`;
- } else {
- existingFileNames[lcFileName] = 1;
-
- return fileName;
}
+ existingFileNames[lcFileName] = 1;
+
+ return fileName;
+
}
function getDataFileName(type: NoteType | null, mime: string, baseFileName: string, existingFileNames: Record<string, number>): string {
@@ -89,15 +88,15 @@ async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch,
// Crop fileName to avoid its length exceeding 30 and prevent cutting into the extension.
if (fileName.length > 30) {
// We use regex to match the extension to preserve multiple dots in extensions (e.g. .tar.gz).
- let match = fileName.match(/(\.[a-zA-Z0-9_.!#-]+)$/);
- let ext = match ? match[0] : "";
+ const match = fileName.match(/(\.[a-zA-Z0-9_.!#-]+)$/);
+ const ext = match ? match[0] : "";
// Crop the extension if extension length exceeds 30
const croppedExt = ext.slice(-30);
// Crop the file name section and append the cropped extension
fileName = fileName.slice(0, 30 - croppedExt.length) + croppedExt;
}
- let existingExtension = path.extname(fileName).toLowerCase();
+ const existingExtension = path.extname(fileName).toLowerCase();
const newExtension = provider.mapExtension(type, mime, existingExtension, format);
// if the note is already named with the extension (e.g. "image.jpg"), then it's silly to append the exact same extension again
@@ -140,7 +139,7 @@ async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch,
const meta: NoteMeta = {
isClone: true,
noteId: note.noteId,
- notePath: notePath,
+ notePath,
title: note.getTitleOrProtected(),
prefix: branch.prefix,
dataFileName: fileName,
@@ -198,16 +197,16 @@ async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch,
meta.attachments = attachments
.toSorted((a, b) => ((a.attachmentId ?? "").localeCompare(b.attachmentId ?? "", "en") ?? 1))
.map((attachment) => {
- const attMeta: AttachmentMeta = {
- attachmentId: attachment.attachmentId,
- title: attachment.title,
- role: attachment.role,
- mime: attachment.mime,
- position: attachment.position,
- dataFileName: getDataFileName(null, attachment.mime, baseFileName + "_" + attachment.title, existingFileNames)
- };
- return attMeta;
- });
+ const attMeta: AttachmentMeta = {
+ attachmentId: attachment.attachmentId,
+ title: attachment.title,
+ role: attachment.role,
+ mime: attachment.mime,
+ position: attachment.position,
+ dataFileName: getDataFileName(null, attachment.mime, `${baseFileName }_${ attachment.title}`, existingFileNames)
+ };
+ return attMeta;
+ });
if (childBranches.length > 0) {
meta.dirFileName = getUniqueFilename(existingFileNames, baseFileName);
@@ -421,9 +420,9 @@ async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch,
} else if (attr.value === "root" || attr.value?.startsWith("_")) {
// relations to "named" noteIds can be preserved
return true;
- } else {
- return false;
}
+ return false;
+
});
}
diff --git a/apps/server/src/services/notes.ts b/apps/server/src/services/notes.ts
index 7b368e3b9c..8c4a66f968 100644
--- a/apps/server/src/services/notes.ts
+++ b/apps/server/src/services/notes.ts
@@ -1,7 +1,6 @@
import type { AttachmentRow, AttributeRow, BranchRow, NoteRow } from "@triliumnext/commons";
import { dayjs } from "@triliumnext/commons";
-import { date_utils } from "@triliumnext/core";
-import { events as eventService } from "@triliumnext/core";
+import { date_utils, events as eventService, ValidationError } from "@triliumnext/core";
import fs from "fs";
import html2plaintext from "html2plaintext";
import { t } from "i18next";
@@ -13,7 +12,6 @@ import BAttachment from "../becca/entities/battachment.js";
import BAttribute from "../becca/entities/battribute.js";
import BBranch from "../becca/entities/bbranch.js";
import BNote from "../becca/entities/bnote.js";
-import ValidationError from "../errors/validation_error.js";
import cls from "../services/cls.js";
import log from "../services/log.js";
import protectedSessionService from "../services/protected_session.js";