fix: exempt well-known paths from being handled (#2505)

zio/stable
Mary 2024-01-19 12:13:28 +07:00 committed by GitHub
parent ddca849e0d
commit 2be2733082
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 1 deletions

View File

@ -306,6 +306,8 @@ export const TextLinkOnWebOnly = memo(function DesktopWebTextLink({
) )
}) })
const EXEMPT_PATHS = ['/robots.txt', '/security.txt', '/.well-known/']
// NOTE // NOTE
// we can't use the onPress given by useLinkProps because it will // we can't use the onPress given by useLinkProps because it will
// match most paths to the HomeTab routes while we actually want to // match most paths to the HomeTab routes while we actually want to
@ -350,7 +352,12 @@ function onPressInner(
if (shouldHandle) { if (shouldHandle) {
href = convertBskyAppUrlIfNeeded(href) href = convertBskyAppUrlIfNeeded(href)
if (newTab || href.startsWith('http') || href.startsWith('mailto')) { if (
newTab ||
href.startsWith('http') ||
href.startsWith('mailto') ||
EXEMPT_PATHS.some(path => href.startsWith(path))
) {
openLink(href) openLink(href)
} else { } else {
closeModal() // close any active modals closeModal() // close any active modals