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

This commit is contained in:
SiriusXT 2025-06-03 14:27:32 +08:00
parent 4ed30e0624
commit a5ba1b0489

View File

@ -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("?");