web: fix SiteShell breaking links when handlers are updated twice

This commit is contained in:
Jens Langhammer 2021-02-13 18:11:29 +01:00
parent 1649c478b6
commit be292729a5
1 changed files with 5 additions and 1 deletions

View File

@ -89,10 +89,14 @@ export class SiteShell extends LitElement {
if (a.href === "") {
return;
}
if (a.href.startsWith("#")) {
return;
}
try {
const url = new URL(a.href);
const qs = url.search || "";
a.href = `#${url.pathname}${qs}`;
const hash = (url.hash || "#").substring(2, Infinity);
a.href = `#${url.pathname}${qs}${hash}`;
} catch (e) {
console.debug(`authentik/site-shell: error ${e}`);
a.href = `#${a.href}`;