From 69067c680f33695b8335864bf411a0cd670034ec Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Thu, 8 Jan 2026 17:31:16 -0600 Subject: [PATCH] Do not render links if uri is invalid --- src/components/RichText.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/RichText.tsx b/src/components/RichText.tsx index 9908679c57..5420fe6471 100644 --- a/src/components/RichText.tsx +++ b/src/components/RichText.tsx @@ -11,6 +11,9 @@ import {RichTextTag} from '#/components/RichTextTag' import {Text, type TextProps} from '#/components/Typography' const WORD_WRAP = {wordWrap: 1} +// lifted from facet detection in `RichText` impl +const URL_REGEX = + /(^|\s|\()((https?:\/\/[\S]+)|((?[a-z][a-z0-9]*(\.[a-z0-9]+)+)[\S]*))/i export type RichTextProps = TextStyleProp & Pick & { @@ -115,7 +118,8 @@ export function RichText({ , ) } else if (link && AppBskyRichtextFacet.validateLink(link).success) { - if (disableLinks) { + const isValidLink = URL_REGEX.test(link.uri) + if (!isValidLink || disableLinks) { els.push(toShortUrl(segment.text)) } else { els.push(