Skip to content

Build your personal knowledge base with Trilium Notes

chore: address requested changes

Elian Doranb4802e9abfa2
diff --git a/apps/client-standalone/src/lightweight/browser_routes.ts b/apps/client-standalone/src/lightweight/browser_routes.ts
index c60d9f7ddd..556eaf9ce7 100644
--- a/apps/client-standalone/src/lightweight/browser_routes.ts
+++ b/apps/client-standalone/src/lightweight/browser_routes.ts
@@ -180,6 +180,10 @@ function createMockExpressResponse() {
res._headers[name] = value;
return res;
},
+ removeHeader(name: string) {
+ delete res._headers[name];
+ return res;
+ },
status(code: number) {
res._status = code;
return res;
diff --git a/apps/client/src/widgets/react/FormRadioGroup.tsx b/apps/client/src/widgets/react/FormRadioGroup.tsx
index 5be724a8ce..54eaa07fe2 100644
--- a/apps/client/src/widgets/react/FormRadioGroup.tsx
+++ b/apps/client/src/widgets/react/FormRadioGroup.tsx
@@ -20,7 +20,7 @@ export default function FormRadioGroup({ values, ...restProps }: FormRadioProps)
if (!el) return null;
const { value, label, inlineDescription } = el;
return (
- <div className="form-checkbox">
+ <div className="form-checkbox" key={value}>
<FormRadio
value={value}
label={label} inlineDescription={inlineDescription}
@@ -40,7 +40,7 @@ export function FormInlineRadioGroup({ values, ...restProps }: FormRadioProps) {
{values.map((el) => {
if (!el) return null;
const { value, label, inlineDescription } = el;
- return <FormRadio value={value} label={label} inlineDescription={inlineDescription} {...restProps} />;
+ return <FormRadio key={value} value={value} label={label} inlineDescription={inlineDescription} {...restProps} />;
})}
</div>
);
diff --git a/packages/trilium-core/src/routes/api/others.ts b/packages/trilium-core/src/routes/api/others.ts
index 59f1570e07..087391ffa0 100644
--- a/packages/trilium-core/src/routes/api/others.ts
+++ b/packages/trilium-core/src/routes/api/others.ts
@@ -4,12 +4,12 @@ import { RenderMarkdownResponse, ToMarkdownResponse } from "@triliumnext/commons
import type { Request } from "express";
import markdown from "../../services/export/markdown.js";
-import { markdownImportService } from "../..";
+import { markdownImportService, ValidationError } from "../..";
function renderMarkdown(req: Request) {
const { markdownContent } = req.body;
- if (!markdownContent || typeof markdownContent !== 'string') {
- throw new Error('markdownContent parameter is required and must be a string');
+ if (typeof markdownContent !== 'string') {
+ throw new ValidationError('markdownContent parameter is required and must be a string');
}
return {
htmlContent: markdownImportService.renderToHtml(markdownContent, "")
@@ -18,8 +18,8 @@ function renderMarkdown(req: Request) {
function toMarkdown(req: Request) {
const { htmlContent } = req.body;
- if (!htmlContent || typeof htmlContent !== 'string') {
- throw new Error('htmlContent parameter is required and must be a string');
+ if (typeof htmlContent !== 'string') {
+ throw new ValidationError('htmlContent parameter is required and must be a string');
}
return {
markdownContent: markdown.toMarkdown(htmlContent)