fix internal links showing up as external pt2 (#3129)
* fix internal links showing up as external pt2 * fix internal links showing up as external pt2zio/stable
parent
4e6020b88c
commit
800eecbfe4
|
@ -148,6 +148,11 @@ export function feedUriToHref(url: string): string {
|
||||||
export function linkRequiresWarning(uri: string, label: string) {
|
export function linkRequiresWarning(uri: string, label: string) {
|
||||||
const labelDomain = labelToDomain(label)
|
const labelDomain = labelToDomain(label)
|
||||||
|
|
||||||
|
// If the uri started with a / we know it is internal.
|
||||||
|
if (uri.startsWith('/')) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
let urip
|
let urip
|
||||||
try {
|
try {
|
||||||
urip = new URL(uri)
|
urip = new URL(uri)
|
||||||
|
@ -156,10 +161,8 @@ export function linkRequiresWarning(uri: string, label: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const host = urip.hostname.toLowerCase()
|
const host = urip.hostname.toLowerCase()
|
||||||
|
|
||||||
// Hosts that end with bsky.app or bsky.social should be trusted by default.
|
// Hosts that end with bsky.app or bsky.social should be trusted by default.
|
||||||
if (
|
if (
|
||||||
uri.startsWith('/') ||
|
|
||||||
host.endsWith('bsky.app') ||
|
host.endsWith('bsky.app') ||
|
||||||
host.endsWith('bsky.social') ||
|
host.endsWith('bsky.social') ||
|
||||||
host.endsWith('blueskyweb.xyz')
|
host.endsWith('blueskyweb.xyz')
|
||||||
|
|
Loading…
Reference in New Issue