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

View file

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