From 045e6af1d52f83ca88d9e7dda9a9988d9bbc139b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 20 Jun 2024 10:48:01 +0200 Subject: [PATCH] Fix internal link detection Links may also use mailto: or other schemes --- .../app/shared/shared-plugin-pages/plugin-pages.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/app/shared/shared-plugin-pages/plugin-pages.component.ts b/client/src/app/shared/shared-plugin-pages/plugin-pages.component.ts index 36d05766b..954f90289 100644 --- a/client/src/app/shared/shared-plugin-pages/plugin-pages.component.ts +++ b/client/src/app/shared/shared-plugin-pages/plugin-pages.component.ts @@ -43,7 +43,7 @@ export class PluginPagesComponent implements OnDestroy, AfterViewInit { // Get the href attribute set by the dev, not the one calculated by JS to detect if it's a relative/external link const href = a.getAttribute('href') - if (a.target !== '_blank' && !href.match(/^https?:\/\//)) { + if (a.target !== '_blank' && !href.startsWith('/')) { event.preventDefault() event.stopPropagation()