Skip to content

Build your personal knowledge base with Trilium Notes

feat(standalone/setup): decode slashes in error message

Elian Doran5157fd9ecda5
diff --git a/apps/client/src/services/utils.ts b/apps/client/src/services/utils.ts
index c16864c6a6..2afb326f32 100644
--- a/apps/client/src/services/utils.ts
+++ b/apps/client/src/services/utils.ts
@@ -905,6 +905,10 @@ export function getErrorMessage(e: unknown) {
}
+export function replaceHtmlEscapedSlashes(str: string) {
+ return str.replace(///g, "/");
+}
+
/**
* Handles left or right placement of e.g. tooltips in case of right-to-left languages. If the current language is a RTL one, then left and right are swapped. Other directions are unaffected.
* @param placement a string optionally containing a "left" or "right" value.
diff --git a/apps/client/src/setup.tsx b/apps/client/src/setup.tsx
index 21803aad64..6615f11129 100644
--- a/apps/client/src/setup.tsx
+++ b/apps/client/src/setup.tsx
@@ -6,6 +6,7 @@ import { useEffect, useRef, useState } from "preact/hooks";
import { initLocale, t } from "./services/i18n";
import server from "./services/server";
+import { replaceHtmlEscapedSlashes } from "./services/utils";
import Admonition from "./widgets/react/Admonition";
import Button from "./widgets/react/Button";
import { Card, CardFrame, CardSection } from "./widgets/react/Card";
@@ -257,7 +258,7 @@ function SyncFromServer({ setState }: { setState: (state: State) => void }) {
</FormItemWithIcon>
</Collapsible>
- {error && <Admonition className="error" type="caution">{error}</Admonition>}
+ {error && <Admonition className="error" type="caution">{replaceHtmlEscapedSlashes(error)}</Admonition>}
</form>
</main>