Skip to content

Commit

Permalink
fix internal links showing up as external pt2
Browse files Browse the repository at this point in the history
  • Loading branch information
haileyok committed Mar 6, 2024
1 parent 4e6020b commit c08fcbc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/strings/url-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,17 @@ export function linkRequiresWarning(uri: string, label: string) {
try {
urip = new URL(uri)
} catch {
// If the uri started with a / we know it is internal.
if (uri.startsWith('/')) {
return false
}

return true
}

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')
Expand Down

0 comments on commit c08fcbc

Please sign in to comment.