Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 0b1ab39

Browse files
author
Je
committed
fix: fix markdown page link redirect
1 parent 487c2c0 commit 0b1ab39

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

aleph.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ export function ALEPH({ initial }: {
207207
export async function redirect(url: string, replace?: boolean) {
208208
const { location, history } = window as any
209209

210+
if (!util.isNEString(url)) {
211+
return
212+
}
213+
210214
if (util.isHttpUrl(url)) {
211215
location.href = url
212216
return

project.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -855,12 +855,13 @@ export class Project {
855855
` const appLinks = [];`,
856856
` const onClick = e => {`,
857857
` e.preventDefault();`,
858-
` redirect(e.target.getAttribute("href"));`,
858+
` redirect(e.currentTarget.getAttribute("href"));`,
859859
` };`,
860860
` if (ref.current) {`,
861861
` ref.current.querySelectorAll("a").forEach(a => {`,
862-
` if (!/^(https?|mailto|file):/i.test(a.getAttribute("href"))) {`,
863-
` a.addEventListener("click", onClick);`,
862+
` const href = a.getAttribute("href")`,
863+
` if (href && !/^(https?|mailto|file):/i.test(href)) {`,
864+
` a.addEventListener("click", onClick, false);`,
864865
` appLinks.push(a);`,
865866
` }`,
866867
` });`,

0 commit comments

Comments
 (0)