Skip to content

Build your personal knowledge base with Trilium Notes

fix(link): Allow external links containing # to navigate

SiriusXTa5ba1b048937
diff --git a/apps/client/src/services/link.ts b/apps/client/src/services/link.ts
index 0425652f6c..96e97109f4 100644
--- a/apps/client/src/services/link.ts
+++ b/apps/client/src/services/link.ts
@@ -204,11 +204,17 @@ export function parseNavigationStateFromUrl(url: string | undefined) {
return {};
}
+ url = url.trim();
const hashIdx = url.indexOf("#");
if (hashIdx === -1) {
return {};
}
+ // Exclude external links that contain #
+ if (hashIdx !== 0 && !url.includes("/#root")) {
+ return {};
+ }
+
const hash = url.substr(hashIdx + 1); // strip also the initial '#'
let [notePath, paramString] = hash.split("?");