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
zio/stable
Hailey 2024-03-06 11:40:10 -08:00 committed by GitHub
parent 4e6020b88c
commit 800eecbfe4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

View File

@ -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')