mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-18 19:30:27 +08:00
Don’t intercept navigation to external URLs in Markdown
Fixes 928 Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
This commit is contained in:
@@ -45,8 +45,10 @@
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
void router.navigateToUrl("push", url);
|
||||
if (url.origin === window.origin) {
|
||||
event.preventDefault();
|
||||
void router.navigateToUrl("push", url);
|
||||
}
|
||||
}
|
||||
|
||||
function render(content: string): string {
|
||||
|
||||
@@ -436,3 +436,16 @@ test.describe("browser error handling", () => {
|
||||
await expect(page.locator("text=Not able to load file")).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test("external markdown link", async ({ page }) => {
|
||||
await page.route("http://github.github.com/**", route => {
|
||||
return route.fulfill({ body: "hello", contentType: "text/plain" });
|
||||
});
|
||||
await page.goto(`${markdownUrl}/tree/main/cheatsheet.md`);
|
||||
await page
|
||||
.getByRole("link", { name: "Github-flavored Markdown info page" })
|
||||
.click();
|
||||
await expect(page).toHaveURL(
|
||||
"http://github.github.com/github-flavored-markdown/",
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user