From 800eecbfe4746c887933ecd34c20c862220d07ee Mon Sep 17 00:00:00 2001 From: Hailey Date: Wed, 6 Mar 2024 11:40:10 -0800 Subject: [PATCH] fix internal links showing up as external pt2 (#3129) * fix internal links showing up as external pt2 * fix internal links showing up as external pt2 --- src/lib/strings/url-helpers.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/strings/url-helpers.ts b/src/lib/strings/url-helpers.ts index ee88225e..7729e4a3 100644 --- a/src/lib/strings/url-helpers.ts +++ b/src/lib/strings/url-helpers.ts @@ -148,6 +148,11 @@ export function feedUriToHref(url: string): string { export function linkRequiresWarning(uri: string, label: string) { const labelDomain = labelToDomain(label) + // If the uri started with a / we know it is internal. + if (uri.startsWith('/')) { + return false + } + let urip try { urip = new URL(uri) @@ -156,10 +161,8 @@ export function linkRequiresWarning(uri: string, label: string) { } const host = urip.hostname.toLowerCase() - // Hosts that end with bsky.app or bsky.social should be trusted by default. if ( - uri.startsWith('/') || host.endsWith('bsky.app') || host.endsWith('bsky.social') || host.endsWith('blueskyweb.xyz')